package com.eims.sls_app.ui;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.Html;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.text.style.DynamicDrawableSpan;
import android.text.style.ImageSpan;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.TextView.BufferType;

import bls.juejin.cn.R;
import bls.juejin.cn.R.color;
import progressBar.ProgressDialogBar;

import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.MySingleton;
import com.android.volley.toolbox.RequestParams;
import com.android.volley.toolbox.StringXmlRequest;
import com.contans.view.GetMyInfoVo;
import com.contans.view.MainFenxiRowVo;
import com.contans.view.MainFenxiVo;
import com.contans.view.GetMyInfoVo.PL;
import com.contans.view.MainHOngbaoListVo;
import com.eims.sls_app.dataaccess.AppGateway;
import com.eims.sls_app.dataaccess.FollowsBean;
import com.eims.sls_app.dataaccess.IsfollowBean;
import com.eims.sls_app.dataaccess.Schemes;
import com.eims.sls_app.dataaccess.ShowDtMatch;
import com.eims.sls_app.dataaccess.ShowDtMatchOptimize;
import com.eims.sls_app.dataaccess.utils.HttpUtils;
import com.eims.sls_app.fragment.HallFragment;
import com.eims.sls_app.protocol.RspBodyBaseBean;
import com.eims.sls_app.ui.adapter.OrderInfoJcPlayTypeAdapter;
import com.eims.sls_app.ui.adapter.OrderInfoJcPlayTypeAdapter_optimize;
import com.eims.sls_app.utils.App;
import com.eims.sls_app.utils.Arith;
import com.eims.sls_app.utils.LotteryUtils;
import com.eims.sls_app.view.MyListView2;
import com.eims.sls_app.view.MyToast;
import com.eims.sls_app.ui.MyCommonLotteryInfo_jc;
import com.handmark.pulltorefresh.library.internal.Utils;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.XML;

import java.io.Serializable;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * cp 竞彩 投注订单详情
 *
 * @author SLS003
 */
public class MyCommonLotteryInfo_jc extends MyBaseActivity implements OnClickListener {
    private static final String TAG = "MyCommonLotteryInfo_jc";
    private TextView tv_lotteryName, tv_money, tv_state, tv_winMoney, tv_count, tv_time, tv_orderId, tv_betType,
            tv_lotteryNum, tv_name, tv_yong, tv_winMoney3, tv_scheme, tv_buyCount, tv_title, tv_content, tv_show,
            tv_lotteryName_issue, tv_info_tip, tv_bei, tv_orderType;
    private ImageView img_logo, ll_divider;
    private ImageButton betinfo_hide_btn, btn_back;
    private LinearLayout ll_numberCount;
    private MyListView2 mListView;
    private TextView tv_name_circle, tv_name_circle2, tv_yong_circle, tv_yong_circle2, tv_scheme_circle,
            tv_scheme_circle2;
    private TextView tv_win_circle, tv_win_circle2, tv_yj_circle, tv_yj_circle2, tv_zj_circle, tv_zj_circle2;
    private TextView tv_doc_circle;// 跟单查看按钮
    private Schemes scheme;

    private RelativeLayout rl_join1, rl_join2;

    /**
     * 竞彩
     */
    private List<ShowDtMatch> list_show;
    private List<ShowDtMatchOptimize> list_show_optimize;
    // private List<ShowDtMatch> list_show_optimize;
    private List<String> playtypes = new ArrayList<String>();
    private List<String> playResult = new ArrayList<String>();
    private List<String> playLet = new ArrayList<String>();
    private List<List<Map<String, Object>>> playitems = new ArrayList<List<Map<String, Object>>>();
    // 进行优化
    private List<List<String>> playtypesList = null;
    private List<List<String>> playResultList = null;
    private List<List<String>> playLetList = null;
    private List<List<List<Map<String, Object>>>> playitemsList = null;

    private List<String> buyContent = null;
    private List<String> result = null;
    private List<Integer> markRed = null;
    private List<List<String>> buyContents = null; // 奖金优化后的投注详情
    private List<List<String>> results = null; // 比赛结果
    private List<List<Integer>> markReds = null; // 是否标红

    private String opt = "46"; // 格式化后的 opt

    private String auth, info, time, imei, crc; // 格式化后的参数
    private MyAsynTask myAsynTask;
    private MyHandler myHandler;
    private Button btn_jixu;
    private Button btn_touzhu;
    private RelativeLayout rl_optimize;
    private LinearLayout ll_optimize;
    private ImageButton betinfo_optimize_hide_btn;
    private ImageView ll_divider1;
    private MyListView2 lv_betInfo_optimize;
    private TextView tv_show233;
    private RelativeLayout ll_circle_quanzi;
    private TextView tv_Documentary_information;// 跟单信息

    private String preBetType; // 优化方案
    private TextView tv_preBetType;

    private int isHide;// 方案是否可见
    private String secretMsg;// 显示信息
    private TextView tv_secretMsg;// 显示方案信息
    private TextView tv_win_money;// 中奖金额
    private TextView tv_win_money2;
    private String buyTime;

    private List<IsfollowBean> isfollowBeans;
    private List<FollowsBean> followsBeans;
    private boolean isShowCopy = true;
//    public String stoptime;

    public TextView tvFollwNum, tvFollowSee;

    // List集合
    private List<AppGateway> list_appGateWay;

    public static GetMyInfoVo getMyInfoVo;

    private LinearLayout lrWhole, lrdigCommentBody;
    private TextView tvTile, tvFupan, tvFupanOn, tvSnsNum, tvSayNum, tvFahongbao;
    private ImageView ivSnsBtn, ivSnsSay, ivHogbaoGet;
    TextView tvpraiseTextView;
    MyListView2 commentList;
    View lin_dig;

    MyInfoHandler myInfoHandler;
    MydanzanHandler mydanzanHandler;

    MylinAdapter mylinAdapter;
    private MyDanzanAsynTask myDanzanAsynTask;
    private String myid;

    public String DianId;
    private ScrollView scrollView;

    private ArrayList<String> listPeilv = new ArrayList<>();


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_betlottey_info);
        App.activityS.add(this);
        App.activityS1.add(this);
        myInfoHandler = new MyInfoHandler();
        mydanzanHandler = new MydanzanHandler();
        findView();
        initView();
    }

    /**
     * myScrollView.smoothScrollTo(0,20); 初始化UI
     */
    private void findView() {
        ll_circle_quanzi = (RelativeLayout) findViewById(R.id.ll_circle_quanzi);
        tv_doc_circle = (TextView) findViewById(R.id.tv_doc_circle);
        tv_name_circle = (TextView) findViewById(R.id.tv_name_circle);
        tv_name_circle2 = (TextView) findViewById(R.id.tv_name_circle2);
        tv_yong_circle = (TextView) findViewById(R.id.tv_yong_circle);
        tv_yong_circle2 = (TextView) findViewById(R.id.tv_yong_ciecle_2);
        tv_scheme_circle = (TextView) findViewById(R.id.tv_scheme_circle);
        tv_scheme_circle2 = (TextView) findViewById(R.id.tv_scheme_circle2);
        tv_win_circle = (TextView) findViewById(R.id.tv_win_circle);
        tv_win_circle2 = (TextView) findViewById(R.id.tv_win_circle2);
        tv_yj_circle = (TextView) findViewById(R.id.tv_yj_circle);
        tv_yj_circle2 = (TextView) findViewById(R.id.tv_yj_circle2);
        tv_zj_circle = (TextView) findViewById(R.id.tv_zj_circle);
        tv_zj_circle2 = (TextView) findViewById(R.id.tv_zj_circle2);
        tv_lotteryName = (TextView) findViewById(R.id.tv_lotteryName);
        tv_money = (TextView) findViewById(R.id.tv_money2);
        tv_state = (TextView) findViewById(R.id.tv_state2);
        tv_winMoney = (TextView) findViewById(R.id.tv_winMoney2);
        tv_winMoney3 = (TextView) findViewById(R.id.tv_winMoney3);
        tv_count = (TextView) findViewById(R.id.tv_numberCount);
        tv_time = (TextView) findViewById(R.id.tv_time2);
        tv_orderId = (TextView) findViewById(R.id.tv_orderId2);
        tv_betType = (TextView) findViewById(R.id.tv_orderType2);
        tv_lotteryNum = (TextView) findViewById(R.id.tv_num1);
        tv_show = (TextView) findViewById(R.id.tv_show);
        LinearLayout ll_winNumbet = (LinearLayout) findViewById(R.id.ll_winNumbet);
        ll_winNumbet.setVisibility(View.GONE);

        tv_name = (TextView) findViewById(R.id.tv_name2);
        tv_yong = (TextView) findViewById(R.id.tv_yong2);
        tv_scheme = (TextView) findViewById(R.id.tv_scheme2);
        tv_buyCount = (TextView) findViewById(R.id.tv_buy2);
        tv_title = (TextView) findViewById(R.id.tv_schemetitle2);
        // tv_content = (TextView) findViewById(R.id.tv_schemeContent2);
        tv_lotteryName_issue = (TextView) findViewById(R.id.tv_lotteryName_issue);
        tv_info_tip = (TextView) findViewById(R.id.tv_info_tip);
        tv_bei = (TextView) findViewById(R.id.tv_bei);
        tv_orderType = (TextView) findViewById(R.id.tv_orderType);
        img_logo = (ImageView) findViewById(R.id.img_logo);
        mListView = (MyListView2) findViewById(R.id.lv_betInfo);
        mListView.setBackgroundResource(R.color.my_center_bg2);

        tvFollwNum = (TextView) findViewById(R.id.tv_follow_num);
        tvFollowSee = (TextView) findViewById(R.id.tv_follow_see);
        tvFollowSee.setOnClickListener(this);

        int px = dp2px(1);
        mListView.setPadding(px, 0, px, px);
        // gv_winNumber = (MyGridView) findViewById(R.id.gv_winNumber);

        rl_join1 = (RelativeLayout) findViewById(R.id.rl_joinInfo);
        rl_join2 = (RelativeLayout) findViewById(R.id.rl_joinInfo2);

        btn_jixu = (Button) findViewById(R.id.btn_jixu);
        btn_touzhu = (Button) findViewById(R.id.btn_touzhu);

        betinfo_hide_btn = (ImageButton) findViewById(R.id.betinfo_hide_btn);
        ll_numberCount = (LinearLayout) findViewById(R.id.ll_numberCount);
        ll_divider = (ImageView) findViewById(R.id.ll_divider);
        btn_back = (ImageButton) findViewById(R.id.btn_back);

        tv_show233 = (TextView) findViewById(R.id.tv_show233);
        // 奖金优化部分
        rl_optimize = (RelativeLayout) findViewById(R.id.rl_optimize);
        ll_optimize = (LinearLayout) findViewById(R.id.ll_optimize);
        betinfo_optimize_hide_btn = (ImageButton) findViewById(R.id.betinfo_optimize_hide_btn);
        tv_preBetType = (TextView) findViewById(R.id.tv_preBetType);

        ll_divider1 = (ImageView) findViewById(R.id.ll_divider1);
        lv_betInfo_optimize = (MyListView2) findViewById(R.id.lv_betInfo_optimize);
        lv_betInfo_optimize.setBackgroundResource(R.color.my_center_bg2);
        lv_betInfo_optimize.setPadding(px, 0, px, px);

        tv_secretMsg = (TextView) findViewById(R.id.tv_secretMsg);
        // 新添加的部分
        tv_win_money = (TextView) findViewById(R.id.tv_win_money);
        tv_win_money2 = (TextView) findViewById(R.id.tv_win_money2);

        tvTile = (TextView) findViewById(R.id.myinfo_tv_title);
        tvFupan = (TextView) findViewById(R.id.myinfo_tv_fupan);
        tvFupanOn = (TextView) findViewById(R.id.myinfo_tv_fupan_on);
        tvSnsNum = (TextView) findViewById(R.id.tv_sns_num);
        tvSayNum = (TextView) findViewById(R.id.tv_info_num);
        tvpraiseTextView = (TextView) findViewById(R.id.praiseTextView);

        lrWhole = (LinearLayout) findViewById(R.id.myinfo_lr_whole);
        lrdigCommentBody = (LinearLayout) findViewById(R.id.digCommentBody);

        ivSnsBtn = (ImageView) findViewById(R.id.snsBtn);
        ivSnsSay = (ImageView) findViewById(R.id.snsBtn_say);

        lin_dig = (View) findViewById(R.id.lin_dig);

        commentList = (MyListView2) findViewById(R.id.commentList);

        ivHogbaoGet = (ImageView) findViewById(R.id.iv_hongbao_send_bg);
        tvFahongbao = (TextView) findViewById(R.id.tv_fahoonga);
        tvFahongbao.setOnClickListener(this);
        ivHogbaoGet.setOnClickListener(this);

        ivSnsBtn.setOnClickListener(this);
        ivSnsSay.setOnClickListener(this);
        tvFupanOn.setOnClickListener(this);
    }

    private int dp2px(int dp) {
        float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, getResources().getDisplayMetrics());
        return (int) px;
    }

    /**
     * 给控件赋值
     */
    @SuppressWarnings("unchecked")
    @SuppressLint("NewApi")
    private void initView() {
        btn_back.setOnClickListener(this);
        betinfo_hide_btn.setOnClickListener(this);
        betinfo_optimize_hide_btn.setOnClickListener(this);
        ll_numberCount.setOnClickListener(this);
        ll_optimize.setOnClickListener(this);
        btn_jixu.setOnClickListener(this);
        btn_touzhu.setOnClickListener(this);
        tv_doc_circle.setOnClickListener(this);
        btn_jixu.setVisibility(View.GONE);
        myHandler = new MyHandler();

        scheme = (Schemes) getIntent().getSerializableExtra("scheme");
        Log.e(TAG, "initView: " + scheme.toString());
//		scheme = App.scheme;
        /*
         * Bundle bundle = getIntent().getBundleExtra("bundle"); scheme = (Schemes)
         * bundle.getSerializable("scheme");
         */
        // myHandler.sendEmptyMessage(23);
        DianId = scheme.getId();
        myAsynTask = new MyAsynTask();
        myAsynTask.execute();
        if (null == scheme)
            return;
        /** 合买订单状态 */
        if ("false".equalsIgnoreCase(scheme.getIsPurchasing())) {
            tv_info_tip.setText("联盈助手合买详情");
        } else if ("true".equalsIgnoreCase(scheme.getIsPurchasing())) {
            /** 普通订单状态 */
            if (scheme.getIsChase() == 0) {
                tv_info_tip.setText("联盈助手投注详情");
            } else {
                /** 追号订单状态 */
                tv_info_tip.setText("追号投注详情");
            }
        }
        rl_join1.setVisibility(View.GONE);
        rl_join2.setVisibility(View.GONE);
        isShowCopy = true;
        if (scheme.getSecretMsg() != null && scheme.getSecretMsg().length() != 0) {
            isShowCopy = false;
            tv_bei.setText(scheme.getMultiple() + "倍 " + scheme.getSecretMsg());
            if (scheme.getSecretMsg().length() > 3) {
                isShowCopy = false;
            } else {
                isShowCopy = true;
            }
        } else {
            isShowCopy = true;
            tv_bei.setText(scheme.getMultiple() + "倍");
        }

        btn_touzhu.setText(scheme.getLotteryName() + "投注");
        tv_lotteryName.setText(LotteryUtils.getTitleText(scheme.getLotteryID()));
        img_logo.setBackgroundResource(App.allLotteryLogo.get(scheme.getLotteryID()));

        btn_touzhu.setText(scheme.getLotteryName() + "投注");
        tv_lotteryName.setText(LotteryUtils.getTitleText(scheme.getLotteryID()));
        img_logo.setBackgroundResource(App.allLotteryLogo.get(scheme.getLotteryID()));
        tv_lotteryName_issue.setVisibility(View.GONE);
        tv_lotteryName_issue.setText(scheme.getIsuseName() == null ? "" : scheme.getIsuseName() + "期");
        tv_money.setText(scheme.getMoney() + "元");
        /*
         * if (buyTime.equals("")) { tv_time.setText(scheme.getDateTime()); }
         */
        // tv_time.setText(buyTime);
        // tv_time.setText(datatime);
        tv_orderId.setText(scheme.getSchemeNumber());

        if (scheme.getFromClient() == 1)
            tv_betType.setText("网页投注");
        else if (scheme.getFromClient() == 2)
            tv_betType.setText("手机APP投注");

        tv_winMoney.setText("--");
        Log.e("time", scheme.getId() + "");
        // 是否合买
        if (scheme.getIsPurchasing().equals("False")) {
            rl_join1.setVisibility(View.VISIBLE);
            rl_join2.setVisibility(View.VISIBLE);
            DecimalFormat df = new DecimalFormat("#####0.0");
            tv_name.setText(scheme.getInitiateName());
            tv_yong.setText(df.format(scheme.getSchemeBonusScale() * 100) + "%");
            tv_scheme.setText(scheme.getShare() + "份,共" + scheme.getMoney() + "元,每份" + scheme.getShareMoney() + "元");
            tv_buyCount.setText(scheme.getMyBuyShare() + "份  共" + scheme.getMyBuyMoney() + "元");
            tv_title.setText(scheme.getTitle());

            // tv_content.setText(scheme.getDescription());

        }

        if (0 != scheme.getQuashStatus()) {
            tv_state.setText("已撤单");
        } else {
            if ("False".equals(scheme.getSchemeIsOpened())) {
                if (scheme.getSurplusShare() > 0) {
                    tv_state.setText("招募中");
                } else if (scheme.getBuyed().equals("True")) {
                    tv_state.setText("已出票");
                } else
                    tv_state.setText("待出票");
            } else if ("True".equals(scheme.getSchemeIsOpened())) {
                if (scheme.getWinMoneyNoWithTax() > 0) {
                    tv_state.setText("中奖");
                    if (scheme.getDescription() != null && !scheme.getDescription().equals("")) {


                        String[] split = scheme.getDescription().split("加奖juejin310");
                        if (split.length > 1) {
                            double money_zhongjian = Arith.sub(scheme.getWinMoneyNoWithTax(),
                                    Double.parseDouble(split[1]));
                            tv_winMoney.setText(money_zhongjian + "元");
                            if (split[1].equals("0")) {

                            } else {
                                tv_winMoney3.setVisibility(View.VISIBLE);

                                tv_winMoney3.setText("加奖:" + split[1] + "元");
                            }

                            tv_win_money.setVisibility(View.VISIBLE);
                            tv_win_money2.setVisibility(View.VISIBLE);
                            double money = money_zhongjian + Double.parseDouble(split[1]);// 总金额
                            double Commission = money * (scheme.getSchemeBonusScale());// 佣金金额
                            double win = (money - Commission) / (scheme.getMoney());// 每一份中奖金额
                            double win2 = (double) (win * Integer.parseInt(scheme.getMyBuyMoney()));
                            DecimalFormat df = new DecimalFormat("#####0.00");

                            if (scheme.getInitiateName().equals(App.user.getName())) {
                                tv_win_money2.setText((df.format(win2 + Commission)) + "元");
                            } else {
                                tv_win_money2.setText(df.format(win2) + "元");
                            }

                            // tv_winMoney3.setText(WinMoneyNoWithTax);
                        } else {
                            tv_winMoney.setText(scheme.getWinMoneyNoWithTax() + "元");
                        }


                    } else {
                        tv_winMoney.setText(scheme.getWinMoneyNoWithTax() + "元");
                    }

                } else {
                    tv_state.setText("未中奖");
                }
            } else if (scheme.getDescription().contains("加奖：")) {
                tv_state.setText("中奖");
                if (scheme.getDescription() != null && !scheme.getDescription().equals("")) {


                    String[] split = scheme.getDescription().split("加奖：");
                    if (split.length > 1) {
                        double money_zhongjian = Arith.sub(scheme.getWinMoneyNoWithTax(),
                                Double.parseDouble(split[1]));
                        tv_winMoney.setText(money_zhongjian + "元");
                        if (split[1].equals("0")) {

                        } else {
                            tv_winMoney3.setVisibility(View.VISIBLE);

                            tv_winMoney3.setText("加奖:" + split[1] + "元");
                        }

                        tv_win_money.setVisibility(View.VISIBLE);
                        tv_win_money2.setVisibility(View.VISIBLE);
                        double money = money_zhongjian + Double.parseDouble(split[1]);// 总金额
                        double Commission = money * (scheme.getSchemeBonusScale());// 佣金金额
                        double win = (money - Commission) / (scheme.getMoney());// 每一份中奖金额
                        double win2 = (double) (win * Double.parseDouble(scheme.getMyBuyMoney()));
                        DecimalFormat df = new DecimalFormat("#####0.00");

                        if (scheme.getInitiateName().equals(App.user.getName())) {
                            tv_win_money2.setText((df.format(win2 + Commission)) + "元");
                        } else {
                            tv_win_money2.setText(df.format(win2) + "元");
                        }

                        // tv_winMoney3.setText(WinMoneyNoWithTax);
                    } else {
                        tv_winMoney.setText(scheme.getWinMoneyNoWithTax() + "元");
                    }


                } else {
                    tv_winMoney.setText(scheme.getWinMoneyNoWithTax() + "元");
                }
            }
        }

    }

    /*** 异步任务 用来后台获取数据 */

    class MyAsynTask extends AsyncTask<Void, Integer, String> {
        String error = "0";
        // ProgressDialog dialog;

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            ProgressDialogBar.startProgress(MyCommonLotteryInfo_jc.this, "sff", false);
            // dialog = BaseHelper.showProgress(MyCommonLotteryInfo_jc.this, null, "加载中..",
            // true, false);
            // dialog.show();
        }

        @Override
        protected String doInBackground(Void... params) {
            // String key = MD5
            // .md5(App.user.getUserPass() + App.MD5_key);
            String key = App.key;
            opt = "46";
            info = RspBodyBaseBean.changeJC_info(scheme.getId() + "");
            Log.e("time", "竞彩--info--46    " + info);

            crc = RspBodyBaseBean.getCrc(time, imei, key, info, App.user.getUid());
            auth = RspBodyBaseBean.getAuth(crc, time, imei, App.user.getUid());
            /*
             * if (App.user ==null) { crc = RspBodyBaseBean.getCrc(time, imei, key, info,
             * "-1"); auth = RspBodyBaseBean.getAuth(crc, time, imei, "-1"); }else { crc =
             * RspBodyBaseBean.getCrc(time, imei, key, info,App.user.getUid()); auth =
             * RspBodyBaseBean.getAuth(crc, time, imei,App.user.getUid()); }
             */
            Log.i(TAG, "MyCommonLotteryInfo_jc" + RequestParams.convertParams(MyCommonLotteryInfo_jc.this, opt, info));
            String values[] = {opt, auth, info};
            String result = HttpUtils.doPost(App.names, values, App.path);
            Log.e(TAG, result);
            Log.e("time", "竞彩--结果    " + result);
            if ("-500".equals(result))
                return result;

            if (result.length() == 0) {
                Log.e("time", "没有得到数据--！");
                return "-1";
            }
            try {
                JSONObject object = new JSONObject(result);

                error = object.getString("error");
                if ("0".equals(object.getString("error"))) {
                    String s = object.optString("informationId");
//                    stoptime = (String) object.opt("stopsellingtime");
                    // isHide = (Integer) object.opt("isHide");
                    isHide = 0;
                    secretMsg = (String) object.opt("secretMsg");
                    buyTime = (String) object.optString("buyTime");
                    String isfollow = object.getString("isfollow");// 跟单人
                    JSONArray isfollowarray = new JSONArray(isfollow);
                    isfollowBeans = new ArrayList<IsfollowBean>();
                    if (isfollowBeans != null) {
                        for (int i = 0; i < isfollowarray.length(); i++) {
                            IsfollowBean isfollowBean = new IsfollowBean();
                            JSONObject item = isfollowarray.getJSONObject(i);
                            isfollowBean.Name = item.optString("Name");
                            isfollowBean.SchemeNumber = item.optString("SchemeNumber");
                            isfollowBean.ID = item.optString("ID");
                            isfollowBean.m = item.optInt("m");
                            isfollowBeans.add(isfollowBean);
                        }

                    }

                    String follows = object.getString("follows");
                    JSONArray followsarray = new JSONArray(follows);
                    followsBeans = new ArrayList<FollowsBean>();
                    if (followsarray != null) {
                        for (int i = 0; i < followsarray.length(); i++) {
                            FollowsBean followsBean = new FollowsBean();
                            JSONObject item = followsarray.getJSONObject(i);
                            followsBean.Name = item.optString("Name");
                            followsBean.Multiple = item.optInt("Multiple");
                            followsBean.Money = item.optDouble("Money");
                            followsBean.WinMoney = item.optDouble("WinMoney");
                            followsBean.yj = item.optDouble("yj");
                            followsBeans.add(followsBean);
                        }

                    }
                    // 是否合买
                    if (scheme.getIsPurchasing().equals("False")) {
                        String joins = object.getString("joins");
                        JSONArray joinsarray = new JSONArray(joins);
                        list_appGateWay = new ArrayList<AppGateway>();
                        if (joins != null) {
                            for (int i = 0; i < joinsarray.length(); i++) {
                                AppGateway appGateway = new AppGateway();
                                JSONObject jsonObject = (JSONObject) joinsarray.get(i);
                                appGateway.setName(jsonObject.getString("Name").substring(0, 2) + "***");
                                appGateway.setDetailMoney(jsonObject.getString("DetailMoney"));
                                // appGateway.setShare(jsonObject.getString("Share"));
                                appGateway.setDateTime(jsonObject.getString("DateTime"));
                                list_appGateWay.add(appGateway);
                            }
                        }

                    }
                    listPeilv.clear();
                    JSONArray array = new JSONArray(s);
                    if (array.length() == 0)
                        return "-1";
                    list_show = new ArrayList<ShowDtMatch>();
                    if (list_show != null) {
                        for (int i = 0; i < array.length(); i++) {
                            ShowDtMatch dt = new ShowDtMatch();
                            JSONObject item = array.getJSONObject(i);
                            dt.setSchemeId(item.getInt("SchemeID"));
                            dt.setPlayType(item.getInt("PlayType"));
                            dt.setMatchNumber(item.getString("MatchNumber"));
                            dt.setGame(item.getString("Game"));
                            dt.setMainTeam(item.getString("MaiTeam"));
                            dt.setGuestTeam(item.getString("GuestTeam"));
                            dt.setStopSelling(item.getString("StopSelling"));
                            dt.setLetBile(item.getInt("LetBile"));
                            dt.setScore(item.optString("Score"));
                            dt.setResult(item.optString("Results"));
                            dt.setPassType(item.optString("PassType"));
                            dt.setMainLoseball(item.optString("MainLoseball"));
                            dt.setLetScore(item.optDouble("LetScore"));
                            dt.setBigSmallScore(item.optDouble("BigSmallScore"));
                            dt.setStrresult(item.optString("strresult"));
                            dt.setXid(item.optString("xid"));
                            String investContent = item.getString("investContent");
                            dt.setBdsp(item.optString("bdsp"));
                            String Ways = item.getString("Content");
                            String[] st = investContent.split(",");
                            String[] select = new String[st.length];
                            double[] odds = new double[st.length];

                            for (int j = 0; j < st.length; j++) {
                                String[] st2 = LotteryUtils.getRexArray(st[j]);
                                Log.e("time", "选的结果---" + st2[0]);
                                select[j] = st2[0];
                                Log.e("time", "赔率---" + st2[1]);
                                odds[j] = Double.parseDouble(st2[1]);
                            }

                            String[] invest_way = Ways.split(",");

                            int[] investway = new int[invest_way.length];
                            boolean isMixed = false;
                            for (int k = 0; k < invest_way.length; k++) {

                                String[] temp = invest_way[k].split("-");
                                System.out.println("++++++++++====" + temp[0]);
                                investway[k] = Integer.valueOf(temp[0]);
                                if (k == 0 && !(investway[k] / 100 < 0)) {
                                    isMixed = true;
                                }
                            }


                            listPeilv.add(item.getInt("PlayType") + "," + item.optString("bdsp"));

                            dt.setSelect(select);
                            dt.setOdds(odds);
                            dt.setInvestWay(investway);
                            dt.setMixed(isMixed);
                            // Log.e("time", "11111--select----" + select[0]);

                            list_show.add(dt);
                            // Log.e("time", "长度----listShow---" + list_show.size());
                        }

                    }

                    // 奖金优化部分

                    // private String preBetType;//优化方案
                    // private String ggWay;//玩法
                    // private String investNum;//注数
                    // private String buyContent;//购买赛事详情
                    // private String result;//赛果
                    // private String winMoney;//奖金
                    // private String markRed;//是否猜中 "0,0" 0表示未猜中，1表示猜中
                    String optimize = object.optString("optimization");
                    if (!"".equals(optimize)) {
                        preBetType = object.optString("preBetType");
                        JSONArray array1 = new JSONArray(optimize);
                        list_show_optimize = new ArrayList<ShowDtMatchOptimize>();

                        for (int i = 0; i < array1.length(); i++) {
                            ShowDtMatchOptimize dt = new ShowDtMatchOptimize();
                            JSONObject item = array1.getJSONObject(i);

                            dt.setGgWay(item.optString("ggWay"));
                            dt.setInvestNum(item.optString("investNum"));
                            dt.setBuyContent(item.optString("buyContent"));
                            dt.setResult(item.optString("result"));
                            dt.setWinMoney(item.optString("winMoney"));
                            dt.setMarkRed(item.optString("markRed"));

                            list_show_optimize.add(dt);
                        }
                        for (int i = 0; i < list_show_optimize.size(); i++) {
                            Log.i(TAG, list_show_optimize.get(i).toString());
                        }
                    }
                    /*
                     * String optimize = object.optString("optimization"); if (!"".equals(optimize))
                     * { JSONArray array1 = new JSONArray(optimize); list_show_optimize = new
                     * ArrayList<ShowDtMatch>(); for (int i = 0; i < array1.length(); i++) {
                     * ShowDtMatch dt = new ShowDtMatch(); JSONObject item =
                     * array1.getJSONObject(i); dt.setSchemeId(item.getInt("SchemeID"));
                     * dt.setPlayType(item.getInt("PlayType"));
                     * dt.setMatchNumber(item.getString("MatchNumber"));
                     * dt.setGame(item.getString("Game"));
                     * dt.setMainTeam(item.getString("MaiTeam"));
                     * dt.setGuestTeam(item.getString("GuestTeam"));
                     * dt.setStopSelling(item.getString("StopSelling"));
                     * dt.setLetBile(item.getInt("LetBile")); dt.setScore(item.optString("Score"));
                     * dt.setResult(item.optString("Results"));
                     * dt.setPassType(item.optString("PassType"));
                     * dt.setMainLoseball(item.optInt("MainLoseball"));
                     * dt.setLetScore(item.optDouble("LetScore"));
                     * dt.setBigSmallScore(item.optDouble("BigSmallScore")); String investContent =
                     * item.getString("investContent"); String Ways = item.getString("Content");
                     * String[] st = investContent.split(","); String[] select = new
                     * String[st.length]; double[] odds = new double[st.length];
                     *
                     * for (int j = 0; j < st.length; j++) { String[] st2 =
                     * LotteryUtils.getRexArray(st[j]); // Log.e("time", "选的结果---" + st2[0]);
                     * select[j] = st2[0]; // Log.e("time", "赔率---" + st2[1]); odds[j] =
                     * Double.parseDouble(st2[1]); }
                     *
                     * String[] invest_way = Ways.split(",");
                     *
                     * int[] investway = new int[invest_way.length]; boolean isMixed = false; for
                     * (int k = 0; k < invest_way.length; k++) { String[] temp =
                     * invest_way[k].split("-"); investway[k] = Integer.valueOf(temp[0]); if (k == 0
                     * && !(investway[k] / 100 < 0)) { isMixed = true; } }
                     *
                     * dt.setSelect(select); dt.setOdds(odds); dt.setInvestWay(investway);
                     * dt.setMixed(isMixed); // Log.e("time", "11111--select----" + select[0]);
                     *
                     * list_show_optimize.add(dt); // Log.e("time", "长度----listShow---" +
                     * list_show.size()); }
                     *
                     * }
                     */
                }
            } catch (Exception e) {
                e.printStackTrace();
                Log.e("x", "拿对阵报错--->" + e.getMessage());
                error = "-1";
            }
            return error;
        }

        @Override
        protected void onPostExecute(String result) {
            // dialog.dismiss();

            ProgressDialogBar.stopProgress();
            myHandler.sendEmptyMessage(Integer.parseInt(result));
            Log.e("time", result + "ff");
            super.onPostExecute(result);
        }
    }

    class MygetInfoAsynTask extends AsyncTask<Integer, Integer, String> {

        String error = "-1";

        @Override
        protected String doInBackground(Integer... params) {

            opt = "103";// 92
            time = RspBodyBaseBean.getTime();
            imei = RspBodyBaseBean.getIMEI(MyCommonLotteryInfo_jc.this);
            if (isfollowBeans != null) {
                if (isfollowBeans.size() > 0) {
                    DianId = isfollowBeans.get(0).ID;
                } else {
                    DianId = scheme.getId() + "";
                }
            } else {
                DianId = scheme.getId() + "";
            }
            info = DianId;

            // String key = MD5.md5(App.user.getUserPass() + App.MD5_key);
            String key = App.key;
            if (App.user == null) {
                crc = RspBodyBaseBean.getCrc(time, imei, key, info, "-1");
                auth = RspBodyBaseBean.getAuth(crc, time, imei, "-1");
            } else {
                crc = RspBodyBaseBean.getCrc(time, imei, key, info, App.user.getUid());
                auth = RspBodyBaseBean.getAuth(crc, time, imei, App.user.getUid());
            }

            String[] values = {opt, auth, info};
            Log.i(TAG, "晒单" + RequestParams.convertParams(MyCommonLotteryInfo_jc.this, opt, info));
            String result = HttpUtils.doPost(App.names, values, App.path);
            Log.e(TAG, "晒单11" + result);
            System.out.println("晒单：" + result);
            if ("0".equals(result)) {
                Log.e(TAG, "晒单11" + "jixu1");
                return "-500";

            }
            getMyInfoVo = new GetMyInfoVo();
            try {
                JSONObject jsonObject = new JSONObject(result);

                getMyInfoVo.id = jsonObject.optString("id");
                getMyInfoVo.content = jsonObject.optString("content");
                getMyInfoVo.up = jsonObject.optString("up");
                getMyInfoVo.fp = jsonObject.optString("fp");

                getMyInfoVo.cf = jsonObject.optString("cf");// 0就是不可发红包

                String headUrl = jsonObject.optString("HeadUrl");
                JSONArray comment = jsonObject.getJSONArray("pl");
                List<PL> commentBeanlists = new ArrayList<PL>();
                if (!comment.equals("[]")) {

                    for (int j = 0; j < comment.length(); j++) {
                        JSONObject object2 = comment.getJSONObject(j);
                        PL commentBean = new PL();
                        commentBean.id = object2.optInt("id");
                        commentBean.cid = object2.optInt("cid");
                        commentBean.uid = object2.optInt("uid");
                        commentBean.detail = object2.optString("detail");
                        commentBean.time = object2.optString("time");
                        commentBean.name = object2.optString("name");
                        commentBean.datetime = object2.optString("datetime");
                        commentBean.rname = object2.optString("rname");
                        commentBean.rid = object2.optString("rid");
                        commentBean.ruid = object2.optString("ruid");
                        commentBeanlists.add(commentBean);
                    }
                    getMyInfoVo.pl = commentBeanlists;
                }

                JSONArray commentList = jsonObject.getJSONArray("hb");
                List<MainHOngbaoListVo> mainHOngbaoListVos = new ArrayList<MainHOngbaoListVo>();
                if (!commentList.equals("[]")) {

                    for (int j = 0; j < commentList.length(); j++) {
                        JSONObject object2 = commentList.getJSONObject(j);
                        MainHOngbaoListVo commentBean = new MainHOngbaoListVo();
                        commentBean.id = object2.optString("id");
                        commentBean.limit = object2.optString("limit");
                        commentBean.tilte = object2.optString("tilte");
                        commentBean.uname = object2.optString("uname");
                        commentBean.total = object2.optString("total");
                        commentBean.count = object2.optString("count");
                        commentBean.sy = object2.optString("sy");
                        commentBean.yl = object2.optString("yl");
                        commentBean.sq = object2.optString("sq");
                        commentBean.HeadUrl = headUrl;
                        mainHOngbaoListVos.add(commentBean);
                    }
                    getMyInfoVo.hb = mainHOngbaoListVos;
                }
                myid = getMyInfoVo.getId();
                Log.e(TAG, "晒单11" + "jixu2" + getMyInfoVo.toString());
                error = "0";
            } catch (Exception e) {
                error = "-1";
                Log.e(TAG, "晒单11" + e.getMessage());
                e.printStackTrace();
            }

            Log.e(TAG, "晒单11" + "jixu2");

            return error;
        }

        @Override
        protected void onPostExecute(String result) {

            myInfoHandler.sendEmptyMessage(Integer.parseInt(result));

            super.onPostExecute(result);
        }
    }

    private SpannableString setImageSpan() {
        String text = "  ";
        SpannableString imgSpanText = new SpannableString(text);
        imgSpanText.setSpan(new ImageSpan(MyCommonLotteryInfo_jc.this, R.drawable.social_fave_blue,
                DynamicDrawableSpan.ALIGN_BASELINE), 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        return imgSpanText;
    }

    /**
     * @param str
     * @return
     */
    private SpannableStringBuilder addClickablePart(String str) {
        // 第一个赞图标
        SpannableString spanStr = setImageSpan();

        SpannableStringBuilder ssb = new SpannableStringBuilder(spanStr);
        ssb.append(str);
        String[] likeUsers = str.split(",");

        if (likeUsers.length > 0) {
            // 最后一个
            for (int i = 0; i < likeUsers.length; i++) {
                final String name = likeUsers[i];
                final int start = str.indexOf(name) + spanStr.length();
                ssb.setSpan(new ClickableSpan() {

                    @Override
                    public void onClick(View widget) {
                        // Toast.makeText(MyCommonLotteryInfo_jc.this, name, Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void updateDrawState(TextPaint ds) {
                        super.updateDrawState(ds);
                        ds.setColor(getResources().getColor(R.color.praise_item)); // 设置文本颜色
                        // 去掉下划线
                        ds.setUnderlineText(false);
                    }

                }, start, start + name.length(), 0);
            }
        }
        return ssb;
    }

    // 获取信息
    @SuppressLint("HandlerLeak")
    class MyInfoHandler extends Handler {
        @Override
        public void handleMessage(Message msg) {

            switch (msg.what) {
                case 0:

                    if (!getMyInfoVo.getId().equals("") && getMyInfoVo.getId() != null) {
                        if (DianId.equals(scheme.getId())) {

                            if (getMyInfoVo.getCf().equals("0")) {
                                tvFahongbao.setVisibility(View.GONE);
                            } else {
                                tvFahongbao.setVisibility(View.VISIBLE);
                            }

                        } else {

                            tvFahongbao.setVisibility(View.GONE);
                        }

                        List<MainHOngbaoListVo> hOngbaoListVos = getMyInfoVo.getHb();
                        if (hOngbaoListVos.isEmpty()) {
                            ivHogbaoGet.setVisibility(View.GONE);

                        } else {
                            ivHogbaoGet.setVisibility(View.VISIBLE);
                        }

                        lrWhole.setVisibility(View.VISIBLE);
                        tvTile.setText(getMyInfoVo.getContent());

                        if (!getMyInfoVo.getFp().equals("") && getMyInfoVo.getFp() != null
                                && getMyInfoVo.getFp().length() > 0) {
                            tvFupan.setText(getMyInfoVo.getFp());
                            tvFupanOn.setVisibility(View.GONE);
                        } else {
                            tvFupan.setText("暂无复盘心得！！！");
                            if (DianId.equals(scheme.getId())) {
                                tvFupanOn.setVisibility(View.VISIBLE);

                            } else {

                                tvFupanOn.setVisibility(View.GONE);
                            }

                        }

                        String up = getMyInfoVo.up;

                        SpannableStringBuilder builder = new SpannableStringBuilder();
                        List<PL> commentBeans = getMyInfoVo.getPl();
                        if (commentBeans.isEmpty() && up.equals("")) {
                            lrdigCommentBody.setVisibility(View.GONE);
                            ivSnsBtn.setBackgroundResource(R.drawable.prise2);
                            ivSnsSay.setEnabled(true);
                        } else {
                            lrdigCommentBody.setVisibility(View.VISIBLE);
                        }
                        if (!up.equals("") && up != null && up.length() > 0) {
                            tvpraiseTextView.setVisibility(View.VISIBLE);

                            if (up.contains(App.user.getName())) {
                                ivSnsBtn.setBackgroundResource(R.drawable.prise);
                                ivSnsBtn.setEnabled(false);
                            } else {
                                ivSnsBtn.setBackgroundResource(R.drawable.prise2);
                                ivSnsBtn.setEnabled(true);
                            }

                            // 构造多个超链接的html, 通过选中的位置来获取用户名
                            StringBuilder sbBuilder = new StringBuilder();
                            // for (int i = 0; i < 10; i++) {
                            // sbBuilder.append("username-" + i + "、");
                            // }

                            // builder.append(setImageSpan());
                            String ups = up.substring(0, up.length() - 1);
                            String[] up2 = ups.split(",");
                            tvSnsNum.setText(up2.length + "");
                            String names;
                            for (int i = 0; i < up2.length; i++) {
                                if (isMobileNO(up2[i])) {
                                    names = up2[i].substring(0, 3) + "****" + up2[i].substring(7, up2[i].length());
                                    // holder.tv_name.setText());
                                    if (i == up2.length - 1) {
                                        sbBuilder.append(names + ",");
                                        // builder.append(names);
                                    } else {
                                        sbBuilder.append(names + ",");
                                        // builder.append(names + ",");
                                    }

                                } else {
                                    names = up2[i];
                                    // holder.tv_name.setText(name.substring(0, 2)+"**");
                                    if (i == up2.length - 1) {
                                        // builder.append(names);
                                        sbBuilder.append(names + ",");
                                    } else {
                                        sbBuilder.append(names + ",");
                                        // builder.append(names + ",");
                                    }

                                }
                            }
                            String likeUsers = sbBuilder.substring(0, sbBuilder.lastIndexOf(",")).toString();
                            tvpraiseTextView.setMovementMethod(LinkMovementMethod.getInstance());
                            tvpraiseTextView.setText(addClickablePart(likeUsers), BufferType.SPANNABLE);
                            // holder.tvpraiseTextView.setText(builder);
                        } else {
                            tvpraiseTextView.setVisibility(View.GONE);
                            tvSnsNum.setText("0");
                            ivSnsBtn.setBackgroundResource(R.drawable.prise2);
                            ivSnsBtn.setEnabled(true);
                        }

                        if (!commentBeans.isEmpty() && commentBeans != null && commentBeans.size() > 0) {
                            commentList.setVisibility(View.VISIBLE);
                            lin_dig.setVisibility(View.VISIBLE);
                            mylinAdapter = new MylinAdapter(commentBeans, 0, MyCommonLotteryInfo_jc.this);
                            commentList.setAdapter(mylinAdapter);
                            tvSayNum.setText(commentBeans.size() + "");
                            // mylinAdapter.notifyDataSetInvalidated();
                        } else {
                            tvSayNum.setText("0");
                            commentList.setVisibility(View.GONE);
                            lin_dig.setVisibility(View.GONE);
                        }

                    } else {
                        lrWhole.setVisibility(View.GONE);
                    }

                    break;
                case 1:
                    // MyToast.getToast(context, "重复晒单").show();
                    break;
                case -2:

                    break;
                case -1:

                    break;
                case -11:

                    break;
                case 10:

                    break;
                default:
                    break;
            }
            super.handleMessage(msg);
        }

    }

    public boolean isMobileNO(String mobiles) {
        Pattern p = Pattern.compile("1[0-9]{10}");
        Matcher m = p.matcher(mobiles);
        return m.matches();
    }

    /**
     * 处理页面显示的
     */
    @SuppressLint("HandlerLeak")
    class MyHandler extends Handler {
        @Override
        public void handleMessage(Message msg) {
            Intent intent = null;
            MygetInfoAsynTask infoAsynTask = new MygetInfoAsynTask();
            infoAsynTask.execute();
            switch (msg.what) {
                case 23:
                    myAsynTask = new MyAsynTask();
                    myAsynTask.execute();
                    break;
                case -1:
                    if (list_appGateWay != null) {
                        if (list_appGateWay.size() > 0) {

                            tvFollwNum.setText("总计" + list_appGateWay.size() + "人跟单");

                        }
                    }

                    isHide = 0;

                    if (followsBeans != null) {
                        if (followsBeans.size() > 0) {
                            ll_circle_quanzi.setVisibility(View.VISIBLE);
                            double money = 0;
                            double yongjin = 0;
                            for (int i = 0; i < followsBeans.size(); i++) {
                                money += followsBeans.get(i).WinMoney;
                                yongjin += followsBeans.get(i).yj;
                            }
                            double zjmoney = 0;
                            String[] split = scheme.getDescription().split("加奖juejin310");
                            if (split.length > 1) {
                                double money_zhongjian = Arith.sub(scheme.getWinMoneyNoWithTax(),
                                        Double.parseDouble(split[1]));
                                tv_winMoney.setText(money_zhongjian + "元");
                                if (split[1].equals("0")) {

                                } else {
                                    tv_winMoney3.setVisibility(View.VISIBLE);

                                    tv_winMoney3.setText("加奖:" + split[1] + "元");
                                }
                                zjmoney = money_zhongjian + Double.parseDouble(split[1]) + yongjin;
                            }

                            tv_name_circle.setVisibility(View.GONE);
                            tv_name_circle2.setVisibility(View.GONE);
                            tv_yong_circle.setVisibility(View.GONE);
                            tv_yong_circle2.setVisibility(View.GONE);
                            tv_scheme_circle2.setText(followsBeans.size() + "人");
                            tv_win_circle2.setText(Utils.decimalFormat(money) + "元");
                            tv_yj_circle2.setText(Utils.decimalFormat(yongjin) + "元");
                            tv_zj_circle2.setText(zjmoney + "元");

                            // tv_Documentary_information.setText(Html.fromHtml("跟单人:"+followsBeans.size()+"人<br>总钱数:"+money+"元<br>获得佣金:"+yongjin+"元"));
                        } else if (isfollowBeans.size() > 0) {
                            ll_circle_quanzi.setVisibility(View.VISIBLE);
                            tv_scheme_circle.setVisibility(View.GONE);
                            tv_scheme_circle2.setVisibility(View.GONE);
                            tv_yj_circle.setVisibility(View.GONE);
                            tv_yj_circle2.setVisibility(View.GONE);
                            tv_win_circle.setVisibility(View.GONE);
                            tv_win_circle2.setVisibility(View.GONE);
                            tv_yong_circle.setVisibility(View.GONE);
                            tv_yong_circle2.setVisibility(View.GONE);
                            tv_zj_circle.setVisibility(View.GONE);
                            tv_zj_circle2.setVisibility(View.GONE);
                            tv_doc_circle.setVisibility(View.GONE);
                            String name = isfollowBeans.get(0).Name;
                            String isname;
                            if (isMobileNO(name)) {
                                isname = name.substring(0, 3) + "****" + name.substring(7, name.length());
                                // holder.tv_name.setText());
                            } else {
                                isname = name;
                                // holder.tv_name.setText(name.substring(0, 2)+"**");
                            }

                            tv_name_circle2.setText("我跟单了\"" + isname + "\"的方案");
                            isHide = 0;
                            // tv_yong_circle2.setText("10%（其中2%作为cp站推广费）");
                            // tv_Documentary_information.setText(Html.fromHtml("此单跟于："+isfollowBeans.get(0).Name+"<br>(其中佣金比例10%)"));
                        }
                    }
                    // MyToast.getToast(getApplicationContext(), "没有数据").show();

                    // tv_Documentary_information.setText("此单根于："+isfollowBeans.get(0).Name+"
                    // 其中佣金比例10%");
                    tv_time.setText(buyTime);

                    break;
                case 0:
                    if (list_appGateWay != null) {
                        if (list_appGateWay.size() > 0) {

                            tvFollwNum.setText("总计" + list_appGateWay.size() + "人跟单");

                        }
                    }

                    isHide = 0;
                    if (followsBeans != null) {
                        if (followsBeans.size() > 0) {
                            ll_circle_quanzi.setVisibility(View.VISIBLE);
                            double money = 0;
                            double yongjin = 0;
                            for (int i = 0; i < followsBeans.size(); i++) {
                                money += followsBeans.get(i).WinMoney;
                                yongjin += followsBeans.get(i).yj;
                            }
                            double zjmoney = 0;
                            String[] split = scheme.getDescription().split("加奖juejin310");

                            if (split.length > 1) {
                                double money_zhongjian = Arith.sub(scheme.getWinMoneyNoWithTax(),
                                        Double.parseDouble(split[1]));
                                tv_winMoney.setText(money_zhongjian + "元");
                                if (split[1].equals("0")) {

                                } else {
                                    tv_winMoney3.setVisibility(View.VISIBLE);

                                    tv_winMoney3.setText("加奖:" + split[1] + "元");
                                }
                                zjmoney = money_zhongjian + Double.parseDouble(split[1]) + yongjin;
                            }
                            if (scheme.getWinMoneyNoWithTax() == 0) {
                                tv_zj_circle.setVisibility(View.GONE);
                                tv_zj_circle2.setVisibility(View.GONE);
                            } else {
                                tv_zj_circle2.setText(Utils.decimalFormat(zjmoney) + "元");
                            }
                            tv_name_circle.setVisibility(View.GONE);
                            tv_name_circle2.setVisibility(View.GONE);
                            tv_yong_circle.setVisibility(View.GONE);
                            tv_yong_circle2.setVisibility(View.GONE);
                            tv_scheme_circle2.setText(followsBeans.size() + "人");
                            tv_win_circle2.setText(Utils.decimalFormat(money) + "元");
                            tv_yj_circle2.setText(Utils.decimalFormat(yongjin) + "元");
                            // tv_Documentary_information.setText("跟单人："+followsBeans.size()+"人
                            // 总钱数："+money+"元 获得佣金："+yongjin+"");
                        } else if (isfollowBeans.size() > 0) {
                            ll_circle_quanzi.setVisibility(View.VISIBLE);
                            tv_scheme_circle.setVisibility(View.GONE);
                            tv_scheme_circle2.setVisibility(View.GONE);
                            tv_yj_circle.setVisibility(View.GONE);
                            tv_yj_circle2.setVisibility(View.GONE);
                            tv_win_circle.setVisibility(View.GONE);
                            tv_win_circle2.setVisibility(View.GONE);
                            tv_yong_circle.setVisibility(View.GONE);
                            tv_yong_circle2.setVisibility(View.GONE);
                            tv_zj_circle.setVisibility(View.GONE);
                            tv_zj_circle2.setVisibility(View.GONE);
                            tv_doc_circle.setVisibility(View.GONE);
                            String name = isfollowBeans.get(0).Name;
                            String isname;
                            if (isMobileNO(name)) {
                                isname = name.substring(0, 3) + "****" + name.substring(7, name.length());
                                // holder.tv_name.setText());
                            } else {
                                isname = name;
                                // holder.tv_name.setText(name.substring(0, 2)+"**");
                            }
                            isHide = 0;
                            tv_name_circle2.setText("我跟单了\"" + isname + "\"的方案");
                            // tv_yong_circle2.setText("10%（其中2%作为cp站推广费）");
                            // tv_Documentary_information.setText("此单根于："+isfollowBeans.get(0).Name+"
                            // 其中佣金比例10%");
                        }
                    }

                    if (isHide == 0) {
                        if (list_show_optimize != null) {
                            if (list_show_optimize.size() > 0) {
                                Log.e("time", "-2");
                                tv_show233.setText("优化前的方案:");
                                rl_optimize.setVisibility(View.VISIBLE);

                                betinfo_hide_btn.setSelected(true);
                                ll_divider.setVisibility(View.GONE);
                                mListView.setVisibility(View.GONE);

                                betinfo_optimize_hide_btn.setSelected(false);
                                ll_divider1.setVisibility(View.VISIBLE);
                                lv_betInfo_optimize.setVisibility(View.VISIBLE);
                                tv_preBetType.setText(preBetType);

                                setData(); // 将在adapter中处理的数据拿出来处理 改完需求再优化
                                setOptimizeData();

                                mListView.setAdapter(new MyAdapter(getApplicationContext()));
                                lv_betInfo_optimize.setAdapter(new MyAdapter_optimize(getApplicationContext()));
                            } else {
                                Log.e("time", "-3");
                                betinfo_hide_btn.setSelected(false);
                                tv_show233.setText("选号详情:");
                                tv_time.setText(buyTime);
                                rl_optimize.setVisibility(View.GONE);
                                setData();
                                mListView.setAdapter(new MyAdapter(getApplicationContext()));

                            }
                        }

                    } else if (isHide == 1) {
                        if (list_show_optimize != null) {
                            if (list_show_optimize.size() > 0) {
                                betinfo_hide_btn.setSelected(true);
                                betinfo_optimize_hide_btn.setSelected(true);
                                ll_divider.setVisibility(View.GONE);

                                betinfo_hide_btn.setClickable(false);
                                betinfo_optimize_hide_btn.setClickable(false);
                            } else {
                                betinfo_hide_btn.setSelected(false);
                                betinfo_hide_btn.setClickable(false);
                            }
                            tv_time.setText(buyTime);
                            // tv_secretMsg.setText(secretMsg);
                        }
                    }
                    Log.e("time", "-1");
                    // if (list_show_optimize.size()>0) {
                    // tv_show233.setText("优化前的方案:");
                    // rl_optimize.setVisibility(View.VISIBLE);
                    //
                    // betinfo_hide_btn.setSelected(true);
                    // ll_divider.setVisibility(View.GONE);
                    // mListView.setVisibility(View.GONE);
                    //
                    // betinfo_optimize_hide_btn.setSelected(false);
                    // ll_divider1.setVisibility(View.VISIBLE);
                    // lv_betInfo_optimize.setVisibility(View.VISIBLE);
                    // tv_preBetType.setText(preBetType);
                    //
                    // //TODO 显示优化的方式
                    // setData(); //将在adapter中处理的数据拿出来处理 改完需求再优化
                    // setOptimizeData();
                    //
                    // mListView.setAdapter(new MyAdapter(getApplicationContext()));
                    // lv_betInfo_optimize.setAdapter(new
                    // MyAdapter_optimize(getApplicationContext()));
                    // }else {
                    // betinfo_hide_btn.setSelected(false);
                    // tv_show233.setText("选号详情:");
                    // rl_optimize.setVisibility(View.GONE);
                    // setData();
                    // mListView.setAdapter(new MyAdapter(getApplicationContext()));
                    //
                    // }
                    // tv_count.setText(list_show.size() + "场");
                    tv_time.setText(buyTime);
                    if (!TextUtils.isEmpty(list_show.get(0).getPassType())) {
                        tv_orderType.setVisibility(View.VISIBLE);
                        tv_orderType.setText("过关方式：" + list_show.get(0).getPassType());
                    }

                    break;
                case 100:
                    intent = new Intent(MyCommonLotteryInfo_jc.this, Select_jczqActivity.class);
                    MyCommonLotteryInfo_jc.this.startActivity(intent);
                    break;
                case 110:
                    intent = new Intent(MyCommonLotteryInfo_jc.this, Select_jclqActivity.class);
                    intent.putExtra("from", "MyCommonLotteryInfo_jc");
                    MyCommonLotteryInfo_jc.this.startActivity(intent);
                    break;
            }
        }

        private void setOptimizeData() {
            buyContents = new ArrayList<List<String>>();
            results = new ArrayList<List<String>>();
            markReds = new ArrayList<List<Integer>>();
            String buyContentStr = null;
            String resultStr = null;
            String markRedStr = null;
            if (list_show_optimize != null) {
                for (int i = 0; i < list_show_optimize.size(); i++) {
                    buyContent = new ArrayList<String>();
                    result = new ArrayList<String>();
                    markRed = new ArrayList<Integer>();
                    // 处理投注内容
                    buyContentStr = list_show_optimize.get(i).getBuyContent().trim();
                    String[] buyContentStrs = buyContentStr.split(",");
                    for (int j = 0; j < buyContentStrs.length; j++) {
                        buyContent.add(buyContentStrs[j]);
                    }
                    buyContents.add(buyContent);

                    // 处理投注结果
                    resultStr = list_show_optimize.get(i).getResult().trim();
                    String[] resultStrs = resultStr.split(",");
                    for (int j = 0; j < resultStrs.length; j++) {
                        result.add(resultStrs[j]);
                    }
                    results.add(result);

                    // 处理标红信息
                    markRedStr = list_show_optimize.get(i).getMarkRed().trim();
                    String[] markRedStrs = markRedStr.split(",");
                    for (int j = 0; j < markRedStrs.length; j++) {
                        markRed.add(Integer.parseInt(markRedStrs[j]));
                    }
                    markReds.add(markRed);

                }
            }

        }

        private void setData() {
            // 开始优化
            playtypesList = new ArrayList<List<String>>();
            playLetList = new ArrayList<List<String>>();
            playResultList = new ArrayList<List<String>>();
            playitemsList = new ArrayList<List<List<Map<String, Object>>>>();
            if (list_show != null) {
                for (int i = 0; i < list_show.size(); i++) {
                    setMixedBetingType(list_show.get(i));
                    playtypesList.add(playtypes);
                    playLetList.add(playLet);
                    playResultList.add(playResult);
                    playitemsList.add(playitems);
                }
            }

        }
    }

    /**
     * Adapter
     **/
    class MyAdapter extends BaseAdapter {
        private Context context;

        public MyAdapter(Context _context) {
            this.context = _context;
        }

        @Override
        public int getCount() {
            if (list_show == null) {
                return 0;
            }
            return list_show.size();
        }

        @Override
        public Object getItem(int arg0) {
            if (list_show == null) {
                return arg0;
            }
            return list_show.get(arg0);
        }

        @Override
        public long getItemId(int arg0) {
            return arg0;
        }

        @Override
        public View getView(int position, View view, ViewGroup arg2) {
            ViewHolder holder;
            final ShowDtMatch showDtmatch = list_show.get(position);
            if (null == view) {
                holder = new ViewHolder();
                LayoutInflater inflater = LayoutInflater.from(context);
                view = inflater.inflate(R.layout.orderinfo_jc_item_52, null);
                holder.orderinfo_jc_title = (LinearLayout) view.findViewById(R.id.orderinfo_jc_title);
                holder.tv_time = (TextView) view.findViewById(R.id.tv_time);
                holder.tv_team = (TextView) view.findViewById(R.id.tv_team);
                holder.orderinfo_jc_listview = (MyListView2) view.findViewById(R.id.orderinfo_jc_listview);
                view.setTag(holder);
            } else {
                holder = (ViewHolder) view.getTag();
            }

            holder.orderinfo_jc_title.setVisibility(position == 0 ? View.VISIBLE : View.GONE);
            showDtmatch.setMatchNumber(showDtmatch.getMatchNumber().replace("星期", "周"));
            holder.tv_time.setText(Html.fromHtml(showDtmatch.getMatchNumber().substring(0, 2) + "<br>"
                    + showDtmatch.getMatchNumber().substring(2, 5)));


            if (scheme.getLotteryID().equals("72")) {
                if (!showDtmatch.getResult().equals("") && showDtmatch.getResult() != null) {
                    holder.tv_time.setText(Html.fromHtml(showDtmatch.getMatchNumber().substring(0, 2) + "<br>"
                            + showDtmatch.getMatchNumber().substring(2, 5)));

                    holder.tv_time.setTextColor(context.getResources().getColor(color.black));
                    holder.tv_time.getPaint().setFlags(0 | Paint.ANTI_ALIAS_FLAG);// 下划线
                    holder.tv_time.setOnClickListener(new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                            // TODO Auto-generated method stub

                        }
                    });
                } else {

                    holder.tv_time.setText(Html.fromHtml(showDtmatch.getMatchNumber().substring(0, 2) + "<br>"
                            + showDtmatch.getMatchNumber().substring(2, 5)));

//					holder.tv_time.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);// 下划线
//
//					holder.tv_time.setTextColor(context.getResources().getColor(color.blue_sky));
//
//					holder.tv_time.setOnClickListener(new OnClickListener() {
//
//						@Override
//						public void onClick(View v) {
//							// TODO Auto-generated method stub
//
//							getBalllInfo(showDtmatch.getXid(), showDtmatch.getMatchNumber());
//
//						}
//					});
                }

            } else {
                holder.tv_time.setText(Html.fromHtml(showDtmatch.getMatchNumber().substring(0, 2) + "<br>"
                        + showDtmatch.getMatchNumber().substring(2, 5)));
            }
            if (showDtmatch.getScore().equals("")) {
                holder.tv_team
                        .setText(Html.fromHtml(showDtmatch.getMainTeam() + "<br>vs<br>" + showDtmatch.getGuestTeam()));
            } else {
                holder.tv_team.setText(Html.fromHtml(showDtmatch.getMainTeam() + "<br><font color=\"#BE0205\">"
                        + showDtmatch.getScore().replace("-",":") + "</font><br>" + showDtmatch.getGuestTeam()));
            }

            // Log.i("MyCommonLotteryInfo_jc", showDtmatch.toString());
            setMixedBetingType(showDtmatch);
            // Log.i("MyCommonLotteryInfo_jc", playitems.toString());

            // TODO 为足彩时传入值为null 可以进行优化
            if (isShowCopy) {
                holder.orderinfo_jc_listview.setAdapter(new OrderInfoJcPlayTypeAdapter(MyCommonLotteryInfo_jc.this,
                        playtypesList.get(position), playResultList.get(position), playitemsList.get(position),
                        playLetList.get(position), true,listPeilv.get(position)));
            } else {
                if (TimeCompare(list_show.get(position).getStopSelling())) {
                    holder.orderinfo_jc_listview.setAdapter(new OrderInfoJcPlayTypeAdapter(MyCommonLotteryInfo_jc.this,
                            playtypesList.get(position), playResultList.get(position), playitemsList.get(position),
                            playLetList.get(position), false,listPeilv.get(position)));
                } else {
                    holder.orderinfo_jc_listview.setAdapter(new OrderInfoJcPlayTypeAdapter(MyCommonLotteryInfo_jc.this,
                            playtypesList.get(position), playResultList.get(position), playitemsList.get(position),
                            playLetList.get(position), true,listPeilv.get(position)));
                }

            }

            // holder.orderinfo_jc_listview
            // .setAdapter(new OrderInfoJcPlayTypeAdapter(
            // MyCommonLotteryInfo_jc.this, playtypes,playResult,playLet,
            // playitems));
            return view;
        }
    }

    public void getBalllInfo(String id, final String wedid) {
        MySingleton mySingleton = MySingleton.getInstance(this);
        ProgressDialogBar.startProgress(this, "", true);
        StringXmlRequest jsonObjectRequest = new StringXmlRequest(Request.Method.GET,
                "http://01link.igowu123.com/zlk/footballTitleData.go?appversion=462&source=1000&logintype=1&mtype=1&rversion=4.6.2&imei=REQ5MjlGOEJBQzA1M0I4QUFFMjIxOEJFMkJENTMyQ0E%3D&osversion=4.4.2&gameid=0&rid=1442435&gtype=70&roundItemId="
                        + id,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String tn) {

                        Log.i("RealTime", "request--------success------" + tn);

                        try {
                            JSONObject item = XML.toJSONObject(tn);

                            MainFenxiVo fenxiVo = new MainFenxiVo();
                            String resultRep = item.optString("Resp");
                            item = new JSONObject(resultRep);
                            String result = item.optString("code");

                            if (result.equals("0")) {
                                fenxiVo.setCode(result);
                                fenxiVo.setDesc(item.optString("desc"));

                                String getRow = item.optString("row");
                                JSONObject itemRow = new JSONObject(getRow);

                                MainFenxiRowVo rowVo = new MainFenxiRowVo();
                                rowVo.setSid(itemRow.optString("sid"));
                                rowVo.setItemId(itemRow.optString("itemId"));
                                rowVo.setRid(itemRow.optString("rid"));
                                rowVo.setHn(itemRow.optString("hn"));
                                rowVo.setGn(itemRow.optString("gn"));
                                rowVo.setHid(itemRow.optString("hid"));
                                rowVo.setGid(itemRow.optString("gid"));
                                rowVo.setHomeRank(itemRow.optString("homeRank"));

                                rowVo.setGuestRank(itemRow.optString("guestRank"));
                                rowVo.setTime(itemRow.optString("time"));

                                rowVo.setHtime(itemRow.optString("htime"));
                                rowVo.setHsc(itemRow.optString("hsc"));
                                rowVo.setAsc(itemRow.optString("asc"));

                                rowVo.setType(itemRow.optString("setType"));

                                rowVo.setServerTime(itemRow.optString("serverTime"));
                                rowVo.setLeaguename(itemRow.optString("leaguename"));

                                rowVo.setRoundnum(itemRow.optString("roundnum"));
                                rowVo.setLogourl(itemRow.optString("logourl"));
                                rowVo.setFollow(itemRow.optString("follow"));
                                rowVo.setLive(itemRow.optString("live"));
                                rowVo.setHalfsc(itemRow.optString("halfsc"));

                                fenxiVo.setRow(rowVo);

                                App.mainFenxiVo = fenxiVo;

                                Log.e("JSON", App.mainFenxiVo.toString());

                                // Intent intentm = new Intent(context, MainFenixActivity.class);

                                Intent intentm = new Intent(MyCommonLotteryInfo_jc.this,
                                        MainLiveixActivity.class);

                                Bundle bundle = new Bundle();
                                bundle.putString("id", wedid);
                                intentm.putExtras(bundle);

                                MyCommonLotteryInfo_jc.this.startActivity(intentm);

                            } else {
                                MyToast.getToast(MyCommonLotteryInfo_jc.this, item.optString("desc")).show();
                            }

                        } catch (JSONException e) {
                            System.err.println("xml->json失败" + e.getLocalizedMessage());
                            MyToast.getToast(MyCommonLotteryInfo_jc.this, "获取失败").show();

                        }
                        ProgressDialogBar.stopProgress();
                    }
                }, new Response.ErrorListener() {

            @Override
            public void onErrorResponse(VolleyError error) {
                Log.i("RealTime", "request--------success------" + error);
                MyToast.getToast(MyCommonLotteryInfo_jc.this, "获取失败").show();
                ProgressDialogBar.stopProgress();
            }
        }) {
            @Override
            protected Map<String, String> getParams() throws AuthFailureError {

                Map<String, String> params = new HashMap<String, String>();
                // params.put("appid", "0af5281058488ec1784e433f69d45d81");
                // params.put("custNo", "gl00014156");
                // params.put("orderId", attach);

                return params;
            }
        };

        jsonObjectRequest.setShouldCache(false);// 是否设置缓存

        mySingleton.addToRequestQueue(jsonObjectRequest);

    }

    public boolean TimeCompare(String date1) {
        // 格式化时间
        boolean isStop = false;
        SimpleDateFormat CurrentTime = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        // String date1="2015-01-25 09:12:09";
        // String date2="2015-01-29 09:12:11";

        Date curDate = new Date(System.currentTimeMillis());// 获取当前时间

        Log.e("time", CurrentTime.format(curDate) + "," + date1);
        try {

            Date beginTime = curDate;
            Date endTime = CurrentTime.parse(date1);
            if ((endTime.getTime() - beginTime.getTime()) > 0) {
                isStop = true;
            } else {
                isStop = false;
            }
            // 判断是否大于两天

        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return isStop;

    }

    /**
     * 奖金优化的Adapter
     **/
    // 这个是修改后的
    class MyAdapter_optimize extends BaseAdapter {
        private Context context;

        public MyAdapter_optimize(Context _context) {
            this.context = _context;
        }

        @Override
        public int getCount() {
            if (list_show_optimize == null) {
                return 0;
            }
            return list_show_optimize.size();
        }

        @Override
        public Object getItem(int arg0) {
            if (list_show_optimize == null) {
                return arg0;
            }
            return list_show_optimize.get(arg0);
        }

        @Override
        public long getItemId(int arg0) {
            return arg0;
        }

        @Override
        public View getView(int position, View view, ViewGroup arg2) {
            ViewHolder_Optimize holder;
            ShowDtMatchOptimize showDtmatch = list_show_optimize.get(position);
            if (null == view) {
                holder = new ViewHolder_Optimize();
                LayoutInflater inflater = LayoutInflater.from(context);
                view = inflater.inflate(R.layout.orderinfo_jc_item_52_optimize, null);
                holder.orderinfo_jc_title_optimize = (LinearLayout) view.findViewById(R.id.orderinfo_jc_title_optimize);
                holder.tv_type_optimize = (TextView) view.findViewById(R.id.tv_type_optimize);
                holder.tv_invest_optimize = (TextView) view.findViewById(R.id.tv_invest_optimize);
                holder.orderinfo_jc_listview_optimize = (MyListView2) view
                        .findViewById(R.id.orderinfo_jc_listview_optimize);
                view.setTag(holder);
            } else {
                holder = (ViewHolder_Optimize) view.getTag();
            }

            holder.orderinfo_jc_title_optimize.setVisibility(position == 0 ? View.VISIBLE : View.GONE);
            holder.tv_type_optimize.setText(showDtmatch.getGgWay());
            holder.tv_invest_optimize.setText(showDtmatch.getInvestNum() + "注");

            // 进行了数据处理的优化
            holder.orderinfo_jc_listview_optimize
                    .setAdapter(new OrderInfoJcPlayTypeAdapter_optimize(MyCommonLotteryInfo_jc.this,
                            buyContents.get(position), results.get(position), markReds.get(position), true));

            // holder.tv_time.setText(Html.fromHtml(showDtmatch.getMatchNumber()
            // .substring(0, 2)
            // + "<br>"
            // + showDtmatch.getMatchNumber().substring(2, 5)));
            // holder.tv_team.setText(Html.fromHtml(showDtmatch.getMainTeam()
            // + "<br>vs<br>" + showDtmatch.getGuestTeam()));
            // setMixedBetingType(showDtmatch);
            //
            // holder.orderinfo_jc_listview
            // .setAdapter(new OrderInfoJcPlayTypeAdapter(
            // MyCommonLotteryInfo_jc.this, playtypes,playResult,playLet,
            // playitems));
            return view;
        }
    }

    private class ViewHolder_Optimize {
        LinearLayout orderinfo_jc_title_optimize;
        TextView tv_type_optimize, tv_invest_optimize;
        MyListView2 orderinfo_jc_listview_optimize;
    }

    /*
     * class MyAdapter_optimize extends BaseAdapter { private Context context;
     *
     * public MyAdapter_optimize(Context _context) { this.context = _context; }
     *
     * @Override public int getCount() { return list_show_optimize.size(); }
     *
     * @Override public Object getItem(int arg0) { return
     * list_show_optimize.get(arg0); }
     *
     * @Override public long getItemId(int arg0) { return arg0; }
     *
     * @Override public View getView(int position, View view, ViewGroup arg2) {
     * ViewHolder holder; ShowDtMatcho showDtmatch =
     * list_show_optimize.get(position); if (null == view) { holder = new
     * ViewHolder(); LayoutInflater inflater = LayoutInflater.from(context); view =
     * inflater.inflate(R.layout.orderinfo_jc_item_52, null);
     * holder.orderinfo_jc_title = (LinearLayout) view
     * .findViewById(R.id.orderinfo_jc_title); holder.tv_time = (TextView)
     * view.findViewById(R.id.tv_time); holder.tv_team = (TextView)
     * view.findViewById(R.id.tv_team); holder.orderinfo_jc_listview = (MyListView2)
     * view .findViewById(R.id.orderinfo_jc_listview); view.setTag(holder); } else {
     * holder = (ViewHolder) view.getTag(); }
     *
     * holder.orderinfo_jc_title .setVisibility(position == 0 ? View.VISIBLE :
     * View.GONE); holder.tv_time.setText(Html.fromHtml(showDtmatch.getMatchNumber()
     * .substring(0, 2) + "<br>" + showDtmatch.getMatchNumber().substring(2, 5)));
     * holder.tv_team.setText(Html.fromHtml(showDtmatch.getMainTeam() + "<br>vs<br>"
     * + showDtmatch.getGuestTeam())); // Log.i("MyCommonLotteryInfo_jc",
     * showDtmatch.toString()); setMixedBetingType(showDtmatch); //
     * Log.i("MyCommonLotteryInfo_jc", playitems.toString());
     *
     * holder.orderinfo_jc_listview .setAdapter(new OrderInfoJcPlayTypeAdapter(
     * MyCommonLotteryInfo_jc.this, playtypes,playResult,playLet, playitems));
     * return view; } }
     */

    private class ViewHolder {
        LinearLayout orderinfo_jc_title;
        TextView tv_time, tv_team;
        MyListView2 orderinfo_jc_listview;
    }

    @Override
    public void onClick(View arg0) {
        switch (arg0.getId()) {

            case R.id.tv_follow_see:
                Bundle bundleFollow = new Bundle();
                bundleFollow.putString("id", scheme.getId());
                Intent intentFollow = new Intent();
                intentFollow.setClass(this, WithFollowdetailsActivity.class);
                intentFollow.putExtras(bundleFollow);
                startActivity(intentFollow);
                break;
            case R.id.btn_touzhu:// 去往本彩种投注
                String lotteryID = scheme.getLotteryID();
                goToSelectLottery(lotteryID);
                break;
            case R.id.betinfo_hide_btn:
            case R.id.ll_numberCount:
                if (!betinfo_hide_btn.isSelected()) {
                    betinfo_hide_btn.setSelected(true);
                    ll_divider.setVisibility(View.GONE);
                    mListView.setVisibility(View.GONE);

                } else {
                    betinfo_hide_btn.setSelected(false);
                    ll_divider.setVisibility(View.VISIBLE);
                    mListView.setVisibility(View.VISIBLE);
                }
                break;
            case R.id.betinfo_optimize_hide_btn:
            case R.id.ll_optimize:
                if (!betinfo_optimize_hide_btn.isSelected()) {
                    betinfo_optimize_hide_btn.setSelected(true);
                    ll_divider1.setVisibility(View.GONE);
                    lv_betInfo_optimize.setVisibility(View.GONE);

                } else {
                    betinfo_optimize_hide_btn.setSelected(false);
                    ll_divider1.setVisibility(View.VISIBLE);
                    lv_betInfo_optimize.setVisibility(View.VISIBLE);
                }
                break;
            case R.id.btn_back:
                finish();
                break;
            case R.id.myinfo_tv_fupan_on:
                if (App.user == null) {
                    Intent intent;
                    MyToast.getToast(this, "请先登陆").show();
                    intent = new Intent(this, LoginActivity.class);
                    intent.putExtra("loginType", "bet");
                    this.startActivity(intent);
                } else {
                    // selectLoctonParse = position;
                    Intent intent = new Intent(this, FupanCommentActivity.class);
                    intent.putExtra("id", Integer.parseInt(DianId));
                    intent.putExtra("position", 0);
                    intent.putExtra("size", 1);
                    this.startActivity(intent);
                    // backListen.onClick(topicBeans.get(position).id, position);
                }
                break;
            case R.id.snsBtn:
                if (App.user == null) {
                    Intent intent;
                    MyToast.getToast(this, "请先登陆").show();
                    intent = new Intent(this, LoginActivity.class);
                    intent.putExtra("loginType", "bet");
                    startActivity(intent);
                } else {
                    info = myid;
                    // selectLoctonParse = position;
                    myDanzanAsynTask = new MyDanzanAsynTask();
                    myDanzanAsynTask.execute();

                }
                break;
            case R.id.snsBtn_say:
                // MyToast.getToast(this,myid).show();
                if (App.user == null) {
                    Intent intent;
                    MyToast.getToast(this, "请先登陆").show();
                    intent = new Intent(this, LoginActivity.class);
                    intent.putExtra("loginType", "bet");
                    this.startActivity(intent);
                } else {
                    // selectLoctonParse = position;
                    Intent intent = new Intent(this, CommentActivity.class);
                    intent.putExtra("id", Integer.parseInt(myid));
                    intent.putExtra("position", 0);
                    intent.putExtra("size", 1);
                    this.startActivity(intent);
                    // backListen.onClick(topicBeans.get(position).id, position);
                }

                break;
            case R.id.tv_doc_circle:
                // MyToast.getToast(this, "查看").show();
                Bundle bundle = new Bundle();
                Intent intent = new Intent(this, WithdetailsActivity.class);
                intent.putExtra("details", (Serializable) followsBeans);

                startActivity(intent);
                break;
            case R.id.iv_hongbao_send_bg:
                Bundle bundleGet = new Bundle();
                Intent intentGet = new Intent(this, MainHongbaoListActivity.class);
                bundleGet.putString("isother", "0");
                bundleGet.putSerializable("hb", (Serializable) getMyInfoVo.getHb());
                intentGet.putExtras(bundleGet);
                startActivity(intentGet);

                break;
            case R.id.tv_fahoonga:
                Bundle bundleHongbao = new Bundle();
                Intent intentHongbao = new Intent(this, MainFaHongbaoActivity.class);
                bundleHongbao.putString("schemeid", scheme.getId());
                intentHongbao.putExtras(bundleHongbao);
                startActivity(intentHongbao);

                break;
        }
    }

    /**
     * 根据彩种id跳转不同选号页面
     *
     * @param lotteryID 彩种id
     */
    private void goToSelectLottery(String lotteryID) {
        int id = Integer.parseInt(lotteryID);
        Intent intent = null;
        switch (id) {
            case 72:// 竞彩足球
            case 73:// 竞彩篮球
            case 45:
                long currentTime_jc = System.currentTimeMillis();
                for (int i = 0; i < HallFragment.listLottery.size(); i++) {
                    if ("72".equals(HallFragment.listLottery.get(i).getLotteryID())
                            || "73".equals(HallFragment.listLottery.get(i).getLotteryID())
                            || "45".equals(HallFragment.listLottery.get(i).getLotteryID())) {
//					if (HallFragment.listLottery.get(i).getDistanceTime() - currentTime_jc <= 0) {
//						MyToast.getToast(getApplicationContext(), "该奖期已结束，请等下一期").show();
//						return;
//					}
                        App.lottery = HallFragment.listLottery.get(i);

                        HallFragment.refreType = true;
                        // 对阵信息是否为空
                        if (App.lottery.getDtmatch() != null && App.lottery.getDtmatch().length() != 0) {
                            if (72 == id && "72".equals(HallFragment.listLottery.get(i).getLotteryID())) {// 竞彩足球
                                new HallFragment().getBallData(MyCommonLotteryInfo_jc.this, 0);
                                break;
                            } else if (73 == id && "73".equals(HallFragment.listLottery.get(i).getLotteryID())) {// 竞彩篮球
                                new HallFragment().getBasketball(MyCommonLotteryInfo_jc.this, 0);
                                // Intent mIntent=new
                                // Intent(MyCommonLotteryInfo_jc.this,Select_jclqActivity.class);
                                // mIntent.putExtra("from","MyCommonLotteryInfo_jc");
                                // startActivity(mIntent);
                                break;
                            } else if (45 == id && "45".equals(HallFragment.listLottery.get(i).getLotteryID())) {// 竞彩篮球
                                new HallFragment().getBjdcData(MyCommonLotteryInfo_jc.this);
                                // Intent mIntent=new
                                // Intent(MyCommonLotteryInfo_jc.this,Select_jclqActivity.class);
                                // mIntent.putExtra("from","MyCommonLotteryInfo_jc");
                                // startActivity(mIntent);
                                break;
                            }
                        } else {
//						MyToast.getToast(MyCommonLotteryInfo_jc.this, "没有对阵信息").show();
                        }
                    }
                }
        }
    }

    /**
     * 将投注的竞彩详情拆分成相应格式的键值对
     *
     * @param dtMatch
     */
    private void setMixedBetingType(ShowDtMatch dtMatch) {
        playtypes.clear();
        playitems.clear();
        playResult.clear();
        playLet.clear();
        String type_normal = null;
        switch (dtMatch.getPlayType()) {
            // 竞彩足球 混合投注
            case 7206: {
                List<Map<String, Object>> items1 = null;
                List<Map<String, Object>> items2 = null;
                List<Map<String, Object>> items3 = null;
                List<Map<String, Object>> items4 = null;
                List<Map<String, Object>> items5 = null;
                String str_type = null;
                String item_result = null;
                for (int i = 0; i < dtMatch.getInvestWay().length; i++) {
                    /*
                     * if (!TextUtils.isEmpty(dtMatch.getResult()) &&
                     * dtMatch.getResult().contains(",")) { item_result =
                     * dtMatch.getResult().split(",")[i];
                     * System.out.println("2017------------1111---------------" +item_result); }
                     */

                    item_result = dtMatch.getResult();

                    switch (dtMatch.getInvestWay()[i] / 100) {
                        case 1:

                            if (dtMatch.getResult().length() > 0) {
                                if (!TextUtils.isEmpty(dtMatch.getResult()) && dtMatch.getResult().contains(",")) {
                                    item_result = dtMatch.getResult().split(",")[i];

                                }
                            } else {
                                item_result = dtMatch.getResult();
                            }
                            // item_result = dtMatch.getResult();
                            str_type = "让球";
                            items1 = setItems(str_type, items1, dtMatch.getSelect()[i], dtMatch.getOdds()[i], item_result,
                                    dtMatch.getMainLoseball() + "");
                            break;
                        case 2:
                            if (dtMatch.getResult().length() > 0) {
                                // item_result = dtMatch.getResult().substring(1);
                                if (!TextUtils.isEmpty(dtMatch.getResult()) && dtMatch.getResult().contains(",")) {
                                    item_result = dtMatch.getResult().split(",")[i];

                                }
                            } else {
                                item_result = dtMatch.getResult();
                            }

                            str_type = "总进球数";
                            items2 = setItems(str_type, items2, dtMatch.getSelect()[i], dtMatch.getOdds()[i], item_result, "0");
                            break;
                        case 3:
                            if (dtMatch.getResult().length() > 3) {
                                // item_result = dtMatch.getResult().substring(1);
                                if (!TextUtils.isEmpty(dtMatch.getResult()) && dtMatch.getResult().contains(",")) {
                                    item_result = dtMatch.getResult().split(",")[i];

                                }
                            } else {
                                item_result = dtMatch.getResult();
                            }
                            str_type = "比分";
                            items3 = setItems(str_type, items3, dtMatch.getSelect()[i], dtMatch.getOdds()[i], item_result, "0");
                            break;
                        case 4:
                            if (dtMatch.getResult().length() > 3) {
                                // item_result = dtMatch.getResult().substring(1);
                                if (!TextUtils.isEmpty(dtMatch.getResult()) && dtMatch.getResult().contains(",")) {
                                    item_result = dtMatch.getResult().split(",")[i];

                                }
                            } else {
                                item_result = dtMatch.getResult();
                            }
                            str_type = "半全场";
                            items4 = setItems(str_type, items4, dtMatch.getSelect()[i], dtMatch.getOdds()[i], item_result, "0");
                            break;
                        case 5:

                            if (dtMatch.getResult().length() > 0) {
                                // item_result = dtMatch.getResult().substring(1);
                                if (!TextUtils.isEmpty(dtMatch.getResult()) && dtMatch.getResult().contains(",")) {
                                    item_result = dtMatch.getResult().split(",")[i];

                                }
                            } else {
                                item_result = dtMatch.getResult();
                            }

                            str_type = "胜平负";
                            items5 = setItems(str_type, items5, dtMatch.getSelect()[i], dtMatch.getOdds()[i], item_result, "0");
                            break;
                    }
                }

                if (playtypes != null) {
                    if (playtypes.size() > 0) {

                        for (int i = 0; i < playtypes.size(); i++) {
                            if (playtypes.get(i).equals("让球")) {
                                playitems.add(items1);
                            } else if (playtypes.get(i).equals("总进球数")) {
                                playitems.add(items2);
                            } else if (playtypes.get(i).equals("比分")) {
                                playitems.add(items3);
                            } else if (playtypes.get(i).equals("半全场")) {
                                playitems.add(items4);
                            } else {
                                playitems.add(items5);
                            }
                        }
                    }

                }

            }
            break;
            // 竞彩篮球 混合投注
            case 7306: {
                List<Map<String, Object>> basket_items1 = null;
                List<Map<String, Object>> basket_items2 = null;
                List<Map<String, Object>> basket_items3 = null;
                List<Map<String, Object>> basket_items4 = null;
                String str_type = null;
                String item_result = null;
                for (int i = 0; i < dtMatch.getInvestWay().length; i++) {
                    if (!TextUtils.isEmpty(dtMatch.getResult()) && dtMatch.getResult().contains(",")) {
                        item_result = dtMatch.getResult().split(",")[i];
                    }
                    switch (dtMatch.getInvestWay()[i] / 100) {
                        case 1: // 胜负
                            if (dtMatch.getResult().length() > 3) {
                                // item_result = dtMatch.getResult().substring(1);
                                if (!TextUtils.isEmpty(dtMatch.getResult()) && dtMatch.getResult().contains(",")) {
                                    item_result = dtMatch.getResult().split(",")[i];

                                }
                            } else {
                                item_result = dtMatch.getResult();
                            }
                            str_type = "胜负";
                            basket_items1 = setItems(str_type, basket_items1, dtMatch.getSelect()[i], dtMatch.getOdds()[i],
                                    item_result, "0");
                            break;
                        case 2:// 让分
                            if (dtMatch.getResult().length() > 4) {
                                // item_result = dtMatch.getResult().substring(1);
                                if (!TextUtils.isEmpty(dtMatch.getResult()) && dtMatch.getResult().contains(",")) {
                                    item_result = dtMatch.getResult().split(",")[i];

                                }
                            } else {
                                item_result = dtMatch.getResult();
                            }

                            // item_result = dtMatch.getResult();
                            str_type = "让分";
                            basket_items2 = setItems(str_type, basket_items2, dtMatch.getSelect()[i], dtMatch.getOdds()[i],
                                    item_result, dtMatch.getLetScore() + "");
                            break;
                        case 3:// 胜分差
                            if (dtMatch.getResult().length() > 7) {
                                // item_result = dtMatch.getResult().substring(1);
                                if (!TextUtils.isEmpty(dtMatch.getResult()) && dtMatch.getResult().contains(",")) {
                                    item_result = dtMatch.getResult().split(",")[i];

                                }
                            } else {
                                item_result = dtMatch.getResult();
                            } // 待开奖
                            str_type = "胜分差";
                            basket_items3 = setItems(str_type, basket_items3, dtMatch.getSelect()[i], dtMatch.getOdds()[i],
                                    item_result, "0");
                            break;
                        case 4:// 大小分
                            if (dtMatch.getResult().length() > 2) {
                                // item_result = dtMatch.getResult().substring(1);
                                if (!TextUtils.isEmpty(dtMatch.getResult()) && dtMatch.getResult().contains(",")) {
                                    item_result = dtMatch.getResult().split(",")[i];

                                }
                            } else {
                                item_result = dtMatch.getResult();
                            }

                            // item_result = dtMatch.getResult();
                            str_type = "大小分";
                            basket_items4 = setItems(str_type, basket_items4, dtMatch.getSelect()[i], dtMatch.getOdds()[i],
                                    item_result, dtMatch.getBigSmallScore() + "");
                            break;
                    }
                }
                if (playtypes != null) {
                    if (playtypes.size() > 0) {
                        for (int i = 0; i < playtypes.size(); i++) {
                            if (playtypes.get(i).equals("胜负")) {
                                playitems.add(basket_items1);
                            } else if (playtypes.get(i).equals("让分")) {
                                playitems.add(basket_items2);
                            } else if (playtypes.get(i).equals("胜分差")) {
                                playitems.add(basket_items3);
                            } else {
                                playitems.add(basket_items4);
                            }
                        }
                    }
                }
            }
            break;
            // 非混合投注
            case 4501: // 足球 让球胜平负
                if (type_normal == null) {
                    type_normal = "让球胜平负" + "(" + dtMatch.getMainLoseball() + ")";
                    ;
                }

            case 4502: // 足球 胜平负
                if (type_normal == null) {
                    type_normal = "总进球";
                }

            case 4503: // 足球 比分
                if (type_normal == null) {
                    type_normal = "上下单双";
                }
            case 4504: // 足球 总进球
                if (type_normal == null) {
                    type_normal = "比分";
                }

            case 4505: // 足球 半全场
                if (type_normal == null) {
                    type_normal = "半全场";
                }
            case 7201: // 足球 让球胜平负
                if (type_normal == null) {
                    type_normal = "让球";
                }

            case 7207: // 足球 胜平负
                if (type_normal == null) {
                    type_normal = "胜平负";
                }

            case 7202: // 足球 比分
                if (type_normal == null) {
                    type_normal = "比分";
                }
            case 7203: // 足球 总进球
                if (type_normal == null) {
                    type_normal = "总进球";
                }

            case 7204: // 足球 半全场
                if (type_normal == null) {
                    type_normal = "半全场";
                }
            case 7301: // 篮球 胜负
                if (type_normal == null) {
                    type_normal = "胜负";
                }
            case 7302: // 篮球 让分
                if (type_normal == null) {
                    type_normal = "让分";
                }
            case 7303: // 篮球 胜分差
                if (type_normal == null) {
                    type_normal = "胜分差";
                }
            case 7304: // 篮球 大小分
                if (type_normal == null) {
                    type_normal = "大小分";
                }
                List<Map<String, Object>> items = null;
                String let = "0";
                if (type_normal.equals("让球")) {
                    let = dtMatch.getMainLoseball() + "";
                } else if (type_normal.equals("让分")) {
                    let = dtMatch.getLetScore() + "";
                } else if (type_normal.equals("大小分")) {
                    let = dtMatch.getBigSmallScore() + "";
                }
                for (int i = 0; i < dtMatch.getInvestWay().length; i++) {
                    items = setItems(type_normal, items, dtMatch.getSelect()[i], dtMatch.getOdds()[i], dtMatch.getResult(),
                            let);
                }
                playitems.add(items);
                break;
        }
    }

    private List<Map<String, Object>> setItems(String playtypename, List<Map<String, Object>> items, String select,
                                               double odd, String result, String concedePoints) {
        if (!playtypes.contains(playtypename)) {
            playtypes.add(playtypename);
            if (result != null && !result.equals("")) {
                // playResult.add(TextUtils.isEmpty(result) ? "待定11" : result);
                playResult.add(result);
            } else {
                playResult.add("待开奖");
            }

            playLet.add(concedePoints);
            items = new ArrayList<Map<String, Object>>();
        }

        Map<String, Object> map = new HashMap<String, Object>();
        map.put("select", select);
        map.put("odd", odd);
        items.add(map);
        return items;
    }

    int onClickPosition;

    class MylinAdapter extends BaseAdapter {

        List<PL> commentBeans;
        int setPosition;
        private Context context;

        public MylinAdapter(List<PL> commentBeans, int setPosition, Context context) {
            super();
            this.commentBeans = commentBeans;
            this.setPosition = setPosition;
            this.context = context;
        }

        public void setComm(int position, PL commentBean) {

            commentBeans.add(commentBean);
            notifyDataSetChanged();

        }

        @Override
        public int getCount() {
            // TODO Auto-generated method stub
            return commentBeans.size();
        }

        @Override
        public Object getItem(int position) {

            return position;
        }

        @Override
        public long getItemId(int position) {

            return position;
        }

        @Override
        public View getView(final int position, View view, ViewGroup parent) {
            ViewHolder4 holder4 = null;
            if (view == null) {
                holder4 = new ViewHolder4();
                view = LayoutInflater.from(context).inflate(R.layout.item_comment, null);
                holder4.tv_comment = (TextView) view.findViewById(R.id.commentTv);

                view.setTag(holder4);

            } else {
                holder4 = (ViewHolder4) view.getTag();
            }

            holder4.tv_comment.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    onClickPosition = position;

                    if (App.user == null) {
                        Intent intent;
                        MyToast.getToast(context, "请先登陆").show();
                        intent = new Intent(context, LoginActivity.class);
                        intent.putExtra("loginType", "bet");
                        startActivity(intent);
                    } else {
                        // selectLoctonParse = position;

                        if (App.user.getUid().equals("" + commentBeans.get(position).uid)) {

                            Intent intent = new Intent(context, CommentActivity.class);
                            intent.putExtra("id", commentBeans.get(position).getCid());
                            intent.putExtra("position", setPosition);
                            intent.putExtra("size", 1);
                            context.startActivity(intent);
                        } else {

                            Intent intent = new Intent(context, RECommentActivity.class);
                            intent.putExtra("id", commentBeans.get(position).getCid());
                            intent.putExtra("pid", commentBeans.get(position).getId());
                            intent.putExtra("name", commentBeans.get(position).name);
                            intent.putExtra("position", setPosition);
                            intent.putExtra("size", 1);
                            context.startActivity(intent);
                            // backListen.onClick(topicBeans.get(position).id, position);\
                        }
                    }
                }
            });
            String name = commentBeans.get(position).name;
            String isname;
            if (isMobileNO(name)) {
                isname = name.substring(0, 3) + "****" + name.substring(7, name.length());
                // holder.tv_name.setText());
            } else {
                isname = name;
                // holder.tv_name.setText(name.substring(0, 2)+"**");
            }

            String REname = commentBeans.get(position).getRname();

            String REisname = "";
            if (!REname.equals("null") && !REname.equals("") && REname != null) {
                if (isMobileNO(REname)) {
                    REisname = REname.substring(0, 3) + "****" + REname.substring(7, REname.length());
                    // holder.tv_name.setText());
                } else {
                    REisname = REname;
                    // holder.tv_name.setText(name.substring(0, 2)+"**");
                }
            }

            String detail = commentBeans.get(position).detail;
            StringBuilder sbBuilder = new StringBuilder();

            sbBuilder.append(isname + "回复");
            if (!REisname.equals("") && REisname != null) {
                sbBuilder.append(REisname + "回复");
            }

            String[] ids = {commentBeans.get(position).uid + "", commentBeans.get(position).ruid};
            String likeUsers = sbBuilder.substring(0, sbBuilder.lastIndexOf("回复")).toString();
            holder4.tv_comment.setMovementMethod(LinkMovementMethod.getInstance());
            holder4.tv_comment.setText(addClickablePartbyAda(likeUsers, detail, ids), BufferType.SPANNABLE);

            // holder4.tv_comment.setText(Html.fromHtml("<font color=\"#8290AF\">" + isname
            // + ":</font>" + detail));
            return view;
        }

        class ViewHolder4 {
            TextView tv_comment;
        }

        /**
         * @param str
         * @return
         */
        private SpannableStringBuilder addClickablePartbyAda(String str, String detail, String[] ids) {

            SpannableStringBuilder ssb = new SpannableStringBuilder();
            ssb.append(str);

            String[] likeUsers = str.split("回复");

            if (likeUsers.length > 0) {
                // 最后一个
                for (int i = 0; i < likeUsers.length; i++) {
                    final String name = likeUsers[i];
                    final String nameid = ids[i];
                    final int start = str.indexOf(name);
                    ssb.setSpan(new ClickableSpan() {

                        @Override
                        public void onClick(View widget) {

                            Bundle bundle = new Bundle();
                            bundle.putString("userId", nameid);

                            Intent intent = new Intent(MyCommonLotteryInfo_jc.this, CirclePersonInfo.class);
                            intent.putExtras(bundle);
                            // intent.putExtra("userId", topicBeans.get(position).id+"");
                            startActivity(intent);

                        }

                        @Override
                        public void updateDrawState(TextPaint ds) {
                            super.updateDrawState(ds);
                            ds.setColor(context.getResources().getColor(R.color.praise_item)); // 设置文本颜色
                            // 去掉下划线
                            ds.setUnderlineText(false);
                        }

                    }, start, start + name.length(), 0);
                }
            }
            return ssb.append(":" + detail);
        } // end of addClick

    }

    @Override
    public void onResume() {
        // TODO Auto-generated method stub
        Log.e("time", "onResume");

        SharedPreferences sharedPreferences = getSharedPreferences("pinglun", Activity.MODE_PRIVATE);
        // 使用getString方法获得value，注意第2个参数是value的默认值

        int isfo = sharedPreferences.getInt("isfr", 0);
        if (isfo == 1) {
            int myuid = sharedPreferences.getInt("uid", 0);
            int myposition = sharedPreferences.getInt("position", 0);
            int myid = sharedPreferences.getInt("id", 0);
            int mycid = sharedPreferences.getInt("cid", 0);
            String mydetail = sharedPreferences.getString("detail", "");
            String mytime = sharedPreferences.getString("time", "");
            String myname = sharedPreferences.getString("name", "");
            String mydatetime = sharedPreferences.getString("datetime", "");
            String myrid = sharedPreferences.getString("rid", "");
            String myrname = sharedPreferences.getString("rname", "");
            String myruid = sharedPreferences.getString("ruid", "");

            PL commentBean = new PL();
            commentBean.id = myid;
            commentBean.cid = mycid;
            commentBean.uid = myuid;
            commentBean.detail = mydetail;
            commentBean.time = mytime;
            commentBean.name = myname;
            commentBean.datetime = mydatetime;
            commentBean.rid = myrid;
            commentBean.rname = myrname;
            commentBean.ruid = myruid;

            // circleBean.comment.get(myposition).add(commentBean);

            lrdigCommentBody.setVisibility(View.VISIBLE);

            commentList.setVisibility(View.VISIBLE);
            lin_dig.setVisibility(View.VISIBLE);

            if (getMyInfoVo.getPl().isEmpty()) {
                List<PL> getMyInfoVoname = new ArrayList<PL>();
                getMyInfoVoname.add(commentBean);
                getMyInfoVo.setPl(getMyInfoVoname);
                mylinAdapter = new MylinAdapter(getMyInfoVoname, 0, this);
                commentList.setAdapter(mylinAdapter);
                tvSayNum.setText(getMyInfoVo.getPl().size() + "");
            } else {
                mylinAdapter.setComm(myposition, commentBean);
                tvSayNum.setText(mylinAdapter.commentBeans.size() + "");
            }

            // circleAdapter.notifyDataSetChanged();
            // Log.e(TAG, commentBean.toString());

            SharedPreferences myAhare = getSharedPreferences("pinglun", Activity.MODE_PRIVATE);
            // 实例化SharedPreferences.Editor对象（第二步）
            SharedPreferences.Editor editor = myAhare.edit();
            // 用putString的方法保存数据
            editor.putInt("isfr", 0);

            editor.commit();
            ProgressDialogBar.stopProgress();
        }

        SharedPreferences fupansharedPreferences = getSharedPreferences("fupan", Activity.MODE_PRIVATE);
        // 使用getString方法获得value，注意第2个参数是value的默认值

        int fupanisfo = fupansharedPreferences.getInt("isfr", 0);
        if (fupanisfo == 1) {

            String mycomment = fupansharedPreferences.getString("comment", "");

            tvFupan.setText(mycomment);
            tvFupanOn.setVisibility(View.GONE);

            // circleAdapter.notifyDataSetChanged();
            // Log.e(TAG, commentBean.toString());

            SharedPreferences myAharefupan = getSharedPreferences("fupan", Activity.MODE_PRIVATE);
            // 实例化SharedPreferences.Editor对象（第二步）
            SharedPreferences.Editor editorfupan = myAharefupan.edit();
            // 用putString的方法保存数据
            editorfupan.putInt("isfr", 0);

            editorfupan.commit();
            ProgressDialogBar.stopProgress();
        }

        super.onResume();
    }

    class MyDanzanAsynTask extends AsyncTask<Integer, Integer, String> {

        String error = "-1";

        @Override
        protected String doInBackground(Integer... params) {

            opt = "87";
            time = RspBodyBaseBean.getTime();
            imei = RspBodyBaseBean.getIMEI(MyCommonLotteryInfo_jc.this);

            // info = RspBodyBaseBean.change_TheSun(schemeId+"", context_Sun);

            // String key = MD5.md5(App.user.getUserPass() + App.MD5_key);
            String key = App.key;
            crc = RspBodyBaseBean.getCrc(time, imei, key, info, App.user.getUid());
            auth = RspBodyBaseBean.getAuth(crc, time, imei, App.user.getUid());
            String[] values = {opt, auth, info};
            Log.i(TAG, "晒单" + RequestParams.convertParams(MyCommonLotteryInfo_jc.this, opt, info));
            String result = HttpUtils.doPost(App.names, values, App.path);
            Log.e(TAG, "晒单：" + result);
            if (result.equals("success")) {
                error = "0";
            }

            return error;
        }

        @Override
        protected void onPostExecute(String result) {

            mydanzanHandler.sendEmptyMessage(Integer.parseInt(result));

            super.onPostExecute(result);
        }
    }

    @SuppressLint("HandlerLeak")
    class MydanzanHandler extends Handler {
        @Override
        public void handleMessage(Message msg) {

            switch (msg.what) {
                case 0:
                    tvSnsNum.setText(Integer.parseInt(tvSnsNum.getText().toString()) + 1 + "");
                    if (getMyInfoVo.getUp() == "") {
                        getMyInfoVo.setUp(getMyInfoVo.getUp() + App.user.getName());
                    } else {
                        getMyInfoVo.setUp(getMyInfoVo.getUp() + App.user.getName() + " ");
                    }
                    String up = getMyInfoVo.up;

                    SpannableStringBuilder builder = new SpannableStringBuilder();
                    List<PL> commentBeans = getMyInfoVo.getPl();
                    if (commentBeans.isEmpty() && up.equals("")) {
                        lrdigCommentBody.setVisibility(View.GONE);
                        ivSnsBtn.setBackgroundResource(R.drawable.prise2);
                        ivSnsSay.setEnabled(true);
                    } else {
                        lrdigCommentBody.setVisibility(View.VISIBLE);
                    }
                    if (!up.equals("") && up != null && up.length() > 0) {
                        tvpraiseTextView.setVisibility(View.VISIBLE);

                        if (up.contains(App.user.getName())) {
                            ivSnsBtn.setBackgroundResource(R.drawable.prise);
                            ivSnsBtn.setEnabled(false);
                        } else {
                            ivSnsBtn.setBackgroundResource(R.drawable.prise2);
                            ivSnsBtn.setEnabled(true);
                        }

                        // 构造多个超链接的html, 通过选中的位置来获取用户名
                        StringBuilder sbBuilder = new StringBuilder();
                        // for (int i = 0; i < 10; i++) {
                        // sbBuilder.append("username-" + i + "、");
                        // }

                        // builder.append(setImageSpan());
                        String ups = up.substring(0, up.length() - 1);
                        String[] up2 = ups.split(",");
                        String names;
                        for (int i = 0; i < up2.length; i++) {
                            if (isMobileNO(up2[i])) {
                                names = up2[i].substring(0, 3) + "****" + up2[i].substring(7, up2[i].length());
                                // holder.tv_name.setText());
                                if (i == up2.length - 1) {
                                    sbBuilder.append(names + ",");
                                    // builder.append(names);
                                } else {
                                    sbBuilder.append(names + ",");
                                    // builder.append(names + ",");
                                }

                            } else {
                                names = up2[i];
                                // holder.tv_name.setText(name.substring(0, 2)+"**");
                                if (i == up2.length - 1) {
                                    // builder.append(names);
                                    sbBuilder.append(names + ",");
                                } else {
                                    sbBuilder.append(names + ",");
                                    // builder.append(names + ",");
                                }

                            }
                        }
                        String likeUsers = sbBuilder.substring(0, sbBuilder.lastIndexOf(",")).toString();
                        tvpraiseTextView.setMovementMethod(LinkMovementMethod.getInstance());
                        tvpraiseTextView.setText(addClickablePart(likeUsers), BufferType.SPANNABLE);
                        // holder.tvpraiseTextView.setText(builder);
                    } else {
                        tvpraiseTextView.setVisibility(View.GONE);

                        ivSnsBtn.setBackgroundResource(R.drawable.prise2);
                        ivSnsBtn.setEnabled(true);
                    }

                    if (!commentBeans.isEmpty() && commentBeans != null && commentBeans.size() > 0) {
                        commentList.setVisibility(View.VISIBLE);
                        lin_dig.setVisibility(View.VISIBLE);
                        mylinAdapter = new MylinAdapter(commentBeans, 0, MyCommonLotteryInfo_jc.this);
                        commentList.setAdapter(mylinAdapter);
                        // mylinAdapter.notifyDataSetInvalidated();
                    } else {
                        commentList.setVisibility(View.GONE);
                        lin_dig.setVisibility(View.GONE);
                    }
                    MyToast.getToast(MyCommonLotteryInfo_jc.this, "点赞成功").show();
                    break;
                case 1:
                    // MyToast.getToast(context, "重复晒单").show();
                    break;
                case -2:

                    break;
                case -1:

                    break;
                case -11:

                    break;
                case 10:

                    break;
                default:
                    break;
            }
            super.handleMessage(msg);
        }

    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        Log.e("xxxa", "tiqu---------23");
        outState.putSerializable("scheme", scheme);
        super.onSaveInstanceState(outState);
    }


    @SuppressWarnings("unchecked")
    @Override
    protected void onRestoreInstanceState(Bundle savedInstanceState) {
        super.onRestoreInstanceState(savedInstanceState);
        Log.e("xxxa", "tiqu---------11");
        if (savedInstanceState != null) {
            scheme = (Schemes) savedInstanceState.getSerializable("scheme");
        }
    }
}
